You are checking if netinfo
is null only after using it, and you probably get a NullPointerException:
Log.v("Test--",""+netInfo.isAvailable()); // << here
if ( netInfo != null && netInfo.isConnectedOrConnecting()&& netInfo.isAvailable()) {
return true;
}
More Related Contents:
- Array of Buttons [closed]
- How to handle button clicks using the XML onClick within Fragments
- Instant run in Android Studio 2.0 (how to turn off)
- Communication between Activity and Service
- Why does Android WebView sporadically not sending my session cookie?
- Build and Install unsigned apk on device without the development server?
- Android Studio – unable to merge from SVN branch
- Android: Clear Cache of All Apps?
- Lazy download images into gridView
- Android, Make an image at a URL equal to ImageView’s image
- Disable EditText blinking cursor
- Google Maps API v2 draw part of circle on MapFragment
- How to change text color of simple list item
- Applying ColorFilter to ImageView with ShapedDrawable
- Google Maps API V2 ‘Failed to Load Map. Could not contact Google Servers’
- Android ‘Unable to add window — token null is not for an application’ exception
- OnItemClickListener using ArrayAdapter for ListView
- How to use SMS content provider? Where are the docs?
- Android Studio Image Asset Launcher Icon Background Color
- Activity killed / onCreate called after taking picture via intent
- Folder added on Android is not visible via USB
- How do I retrieve the logged in Google account on android phones?
- How to verify if user has network access and show a pop-up alert when there isn’t
- Zipalign – Command not found – MAC terminal
- Check if my application has usage access enabled
- Appcompat does not work
- Simplified and Traditional Chinese vs Regions
- How to prevent Android from returning a cached response to my HTTP Request?
- Undefined Reference To ‘cv::initModule_nonfree()’ In Android
- Half circle shape not work