Code example for NetworkInfo

Methods: isConnected

0
        return null; 
    } 
 
    private boolean isNetworkConnected() { 
        NetworkInfo networkInfo = getActiveNetworkInfo();
        return networkInfo != null && networkInfo.isConnected();
    } 
 
    private NetworkInfo getActiveNetworkInfo() {
        ConnectivityManager connectivity =
                (ConnectivityManager) getContext().getSystemService(Context.CONNECTIVITY_SERVICE);
        if (connectivity == null) {
            return null; 
        } 
        return connectivity.getActiveNetworkInfo();
    } 
 
    private static class GoogleSuggestCursor extends AbstractGoogleSourceResult { 
 
        /* Contains the actual suggestions */ 
        private final JSONArray mSuggestions;