How do I know if there were no errors in loading a page in webview? Here is the code for the onReceivedError:
mWebView.setWebViewClient(new WebViewClient() {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
view.stopLoading(); // may not be needed
switch (Locale.getDefault().toString()) {
case "es_ES":
view.loadUrl("file:///android_asset/www/errorPage.forRestActivities.es_ES.HTML");
break;
default:
view.loadUrl("file:///android_asset/www/errorPage.forRestActivities.en_US.HTML");
break;
}
}
});
Setting a flag (isError) did the trick. The flag is set to false when created, as an error is not what's supposes to happens. If it does happens then the flag is set to true. That flag is evaluated at
onPageFinished. If it's true the buttons are not showed otherwise they're