网络相关

    /**
     * 判断有没有网络
     * 
     * @return
     */
    public boolean isNetworkConnected() {

        // 判断网络是否连接
        ConnectivityManager mConnectivityManager = (ConnectivityManager) this
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo mNetworkInfo = mConnectivityManager.getActiveNetworkInfo();

        if (mNetworkInfo != null) {
            return mNetworkInfo.isAvailable();
        }
        return false;
    }

 

posted @ 2014-12-30 09:49  每天学习一点点...  阅读(164)  评论(0编辑  收藏  举报