I find that when the network connection is slow, my Android application is force-closed [closed]

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; 
}

Leave a Comment