private boolean isNetworkAvailable(){
  ConnectivityManager cm=(ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
  NetworkInfo activeNetworkInfo=cm.getActiveNetworkInfo();
  return activeNetworkInfo != null && activeNetworkInfo.isConnected();
}

private boolean isNetworkAvailable ( ) { ConnectivityManager cm = ( ConnectivityManager ) getSystemService ( Context . CONNECTIVITY_SERVICE ) ; NetworkInfo activeNetworkInfo = cm . getActiveNetworkInfo ( ) ; return activeNetworkInfo != null && activeNetworkInfo . isConnected ( ) ; }
check whether any network connection ( wifi / cell ) is available according to the os ' s connectivity service .
