Here you can find the source of isConnected(final NetworkInfo info)
private static boolean isConnected(final NetworkInfo info)
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { public static final boolean isConnected(final Context context, final int... networkTypes) { final ConnectivityManager connectivity = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (networkTypes.length > 0) for (final int networkType : networkTypes) if (ConnectivityManager.isNetworkTypeValid(networkType)) return isConnected(connectivity .getNetworkInfo(networkType)); return isConnected(connectivity.getActiveNetworkInfo()); }/*from w w w . j a va2 s . co m*/ private static boolean isConnected(final NetworkInfo info) { return null != info && info.isConnected(); } }