fun initNetStatus(){
homeNetStatus.setOnClickListener {
val connectivityManager: ConnectivityManager = context!!.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager
val activeNetwork = connectivityManager.activeNetworkInfo
if (activeNetwork !=null && activeNetwork.isConnected){
Log.i("TAG","有连接")
if (activeNetwork.type == ConnectivityManager.TYPE_WIFI){
Log.i("TAG","wifi连接")
}else if (activeNetwork.type == ConnectivityManager.TYPE_MOBILE){
Log.i("TAG","方法连接")
}
}else{
Log.i("TAG","无连接")
}
}
}