Here you can find the source of isConnected(Context context)
public static boolean isConnected(Context context)
//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); }/* w w w . j a v a2 s .c om*/ 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(); } }