Where To Insert Webview Code On Eclipse Mainactivity.java?
Hello, Im trying to insert a piece of a code into my mainactivity so when the user of my webview app tries to open it without having internet connection an error page appears. This
Solution 1:
you can always try and test for connectivity on start and if the device is not connected load actual HTML code from your raw folder instead of from a file.
publicstaticbooleanisConnected(Context context) {
ConnectivityManagercm= (ConnectivityManager) context
.getSystemService(Context.CONNECTIVITY_SERVICE);
NetworkInfoinfo= cm.getActiveNetworkInfo();
if (info == null) {
returnfalse;
}
return info.isConnected();
}
p.s. this requires permission
Post a Comment for "Where To Insert Webview Code On Eclipse Mainactivity.java?"