主要是管理和网络连接相关的操作;
ConnectivityManagercwjManager = (ConnectivityManager)getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info = cwjManager.getActiveNetworkInfo();
if (info != null && info.isAvailable()) {
try {
updateUser(); //说明网络良好
} catch (Exception e) { //网络不好
Toast.makeText(LoginActivity.this, R.string.activity_csm_update_fails,Toast.LENGTH_LONG).show();
}
} else { //网络不好
Toast.makeText(LoginActivity.this,R.string.activitVideo_net_error, Toast.LENGTH_LONG).show();
}