webview:"找不到网页" or "page not found"

来源:互联网 发布:高仿手表淘宝店 编辑:程序博客网 时间:2024/05/30 22:55

解决办法:

实现WebViewClient下面的方法:

@SuppressWarnings("deprecation")@Overridepublic void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {    // Handle the error}@TargetApi(android.os.Build.VERSION_CODES.M)@Overridepublic void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr) {    // Redirect to deprecated method, so you can use it in all SDK versions    onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString());}

参考

https://stackoverflow.com/questions/4997677/android-webview-onreceivederror/4997988#4997988


https://stackoverflow.com/questions/32769505/webviewclient-onreceivederror-deprecated-new-version-does-not-detect-all-errors/32813234#32813234

原创粉丝点击