Context context = this;
WifiManager manager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE);
manager.setWifiEnabled(true);
int wifiState = manager.getWifiState();
int isWiFi = ConnectivityManager.TYPE_WIFI;
if(wifiState == isWiFi){
view.setText(String.valueOf("good"));
}
以上代码就是了