Here you can find the source of isNetworkAvailable(Context context)
public static boolean isNetworkAvailable(Context context)
//package com.java2s; import android.content.Context; import android.net.ConnectivityManager; public class Main { public static boolean isNetworkAvailable(Context context) { boolean netWorkStatus = false; if (null != context) { ConnectivityManager connManager = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if (connManager.getActiveNetworkInfo() != null) { netWorkStatus = connManager.getActiveNetworkInfo() .isAvailable();/*from ww w . j a v a 2s . c o m*/ } } return netWorkStatus; } }