I am using WebView
to view site content. I use the following code to show an error page if there is no internet connection:
mywebview.setWebViewClient(new WebViewClient(){
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
mywebview.loadUrl("file:///android_asset/error.html");
}
});
}
and it is working fine if it is the first time to open the app but if you open it again without internet connection the error page doesn't appear but it uses the cached version and show the site .. and you can open any page you opened before - at the first time - but the other pages just freeze and take no action when you try to open.
what I need is to monitor the internet connection every time you open the app and also while the app is running and show a message tell the user that there is no connection.