is NetWork Info Null - Android Network

Android examples for Network:Network Status

Description

is NetWork Info Null

Demo Code


//package com.java2s;

import android.content.Context;

import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class Main {
    public static boolean isNetWorkInfoNull(Context context) {
        ConnectivityManager conManager = (ConnectivityManager) context
                .getSystemService(Context.CONNECTIVITY_SERVICE);
        NetworkInfo networkInfo = conManager.getActiveNetworkInfo();
        return networkInfo == null ? true : false;
    }//from  w  w  w .j a v a2s.c  om
}

Related Tutorials