Here you can find the source of isConnected(NetworkInfo info)
public static boolean isConnected(NetworkInfo info)
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; public class Main { public static boolean isConnected(Context context) { NetworkInfo info = getNetworkInfo(context); return isConnected(info); }//from w w w . j a va2s . co m public static boolean isConnected(NetworkInfo info) { return info != null && info.isConnected(); } public static NetworkInfo getNetworkInfo(Context context) { ConnectivityManager cm = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); return cm.getActiveNetworkInfo(); } }