摘要:Android - 判斷是否有網路
public static boolean checkWorkStatus(Activity activity) {
ConnectivityManager cm= (ConnectivityManager) activity
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfo info= cm.getActiveNetworkInfo();
if (info != null) {
return true;
} else {
return false;
}
}