Java tutorial
//package com.java2s; import android.content.Context; import android.net.wifi.WifiManager; public class Main { public static boolean isWifiOpen(Context context) throws Exception { int wifiState = getWifiState(context); return wifiState == 3 || wifiState == 2; } public static int getWifiState(Context context) throws Exception { WifiManager wifiManager = (WifiManager) context.getSystemService(Context.WIFI_SERVICE); if (wifiManager != null) { return wifiManager.getWifiState(); } else { throw new Exception("wifi device not found!"); } } }