Here you can find the source of checkWiFi(Context inContext)
public static boolean checkWiFi(Context inContext)
//package com.java2s; import android.content.Context; import android.net.wifi.WifiInfo; import android.net.wifi.WifiManager; public class Main { public static boolean checkWiFi(Context inContext) { WifiManager mWifiManager = (WifiManager) inContext .getSystemService(Context.WIFI_SERVICE); WifiInfo wifiInfo = mWifiManager.getConnectionInfo(); int ipAddress = wifiInfo == null ? 0 : wifiInfo.getIpAddress(); if (mWifiManager.isWifiEnabled() && ipAddress != 0) { return true; } else {/*from w w w . j a va2 s . c o m*/ return false; } } }