http - Android Internet Connection Crash -


my app connectioncheck before connecting html-website , parsing information code:

public boolean networkinfo(context context) { // netzwerk infos anzeigen  if (context != null) {     connectivitymanager mgr = (connectivitymanager) context             .getsystemservice(context.connectivity_service);      if (mgr != null) {         boolean mobilenetwork = false;         boolean wifinetwork = false;          networkinfo mobileinfo = mgr                 .getnetworkinfo(connectivitymanager.type_mobile);         networkinfo wifiinfo = mgr                 .getnetworkinfo(connectivitymanager.type_wifi);          if (mobileinfo != null)             mobilenetwork = mobileinfo.isconnected();         if (wifiinfo != null)             wifinetwork = wifiinfo.isconnected();          return (mobilenetwork || wifinetwork);     } } return false; } 

but during connection internet-state change , app doesn't receive requested information.

how can protect app crashing because of missing data? there checks connection whole time during thread running?


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -