public static boolean isNetworkAvailable(Context context){
  ConnectivityManager connectivityManager=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo info=connectivityManager.getActiveNetworkInfo();
  return info != null && info.isConnected();
}

public static boolean isNetworkAvailable ( Context context ) { ConnectivityManager connectivityManager = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo info = connectivityManager . getActiveNetworkInfo ( ) ; return info != null && info . isConnected ( ) ; }
returns network availability status .
