阻止 WebView 显示“网页不可用”
我有一个广泛使用WebView的应用程序。当此应用程序的用户没有互联网连接时,将显示一个显示“网页不可用”的页面和各种其他文本。有没有办法在我的WebView中不显示此通用文本?我想提供我自己的错误处理。
private final Activity activity = this;
private class MyWebViewClient extends WebViewClient
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
// I need to do something like this:
activity.webView.wipeOutThePage();
activity.myCustomErrorHandling();
Toast.makeText(activity, description, Toast.LENGTH_LONG).show();
}
}
我发现WebView->clearView实际上并没有清除视图。