//判断网络连接 ConnectivityManager cwjManager=(ConnectivityManager)this.getSystemService(Context.CONNECTIVITY_SERVICE); NetworkInfo info = cwjManager.getActiveNetworkInfo(); if (info != null && info.isAvailable()){ Toast.makeText(this,"连接成功",Toast.LENGTH_SHORT).show(); } else { Toast.makeText(this,"无互联网连接",Toast.LENGTH_SHORT).show(); }
网络连接判断
最新推荐文章于 2018-07-08 20:11:51 发布