public static boolean isNetworkAvailable(Context context){
  ConnectivityManager cm=(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo netInfo=cm.getActiveNetworkInfo();
  return netInfo != null && netInfo.isConnectedOrConnecting();
}

public static boolean isNetworkAvailable ( Context context ) { ConnectivityManager cm = ( ConnectivityManager ) context . getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo netInfo = cm . getActiveNetworkInfo ( ) ; return netInfo != null && netInfo . isConnectedOrConnecting ( ) ; }
check availability of internet
