Android中判断网络是否可用

12年前
public static final boolean networkIsAvailable(final Context context) {    NetworkInfo info = ((ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE))      .getActiveNetworkInfo();    return (null != info && info.isAvailable());   }