is Net Connected
//package edu.scut.attmore.qsms.utils; import android.content.Context; import android.net.ConnectivityManager; import android.net.NetworkInfo; /** * @author Attmore * */ class NetUtils { /** * check wheather connected * @param context * @return true connected false not connected */ public static boolean isNetConnected(Context context) { try { ConnectivityManager connManger = (ConnectivityManager) context .getSystemService(Context.CONNECTIVITY_SERVICE); if(connManger!=null) { NetworkInfo netInfo=connManger.getActiveNetworkInfo(); if(netInfo!=null&&netInfo.isConnected()){ if(netInfo.getState()==NetworkInfo.State.CONNECTED){ return true; } } } } catch (Exception e) { // TODO: handle exception } return false; } }