我有一个应用程序,使广泛使用的网络视图。当用户的这个应用程序没有互联网连接,一个页面说“网页不可用”和各种其他文字出现。有没有办法不在我的 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实际上并不能清除视野。