class NoErrorWebViewClient extends WebViewClient {
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Log.e(String.valueOf(errorCode), description);
// API level 5: WebViewClient.ERROR_HOST_LOOKUP
if (errorCode == -2) {
String summary = "<html><body style='background: black;'><p style='color: red;'>Unable to load information. Please check if your network connection is working properly or try again later.</p></body></html>"; view.loadData(summary, "text/html", null);
return;
}
// Default behaviour
super.onReceivedError(view, errorCode, description, failingUrl);
}
}