@SuppressWarnings("deprecation") @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // Handle the error } @TargetApi(android.os.Build.VERSION_CODES.M) @Override public 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()); }
@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { if (AgentWebUtils.isOverriedMethod(mWebViewClient, "onReceivedError", ANDROID_WEBVIEWCLIENT_PATH + ".onReceivedError", WebView.class, WebResourceRequest.class, WebResourceError.class)) { super.onReceivedError(view, request, error); // return; } if (request.isForMainFrame()) { onMainFrameError(view, error.getErrorCode(), error.getDescription().toString(), request.getUrl().toString()); } LogUtils.i(TAG, "onReceivedError:" + error.toString()); }
@TargetApi(Build.VERSION_CODES.M) @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // new API method calls this on every error for each resource. // we only want to interfere if the page itself got problems. String url = request.getUrl().toString(); if (view.getUrl().equals(url)) { handleLoadError(error.getErrorCode()); } } } });
private class myWebViewBrowser extends WebViewClient { @Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { Log.e(String.valueOf(error.getErrorCode()), error.getDescription().toString()); view.loadDataWithBaseURL( "file:///android_asset/", html, "text/html","utf-8", null ); } }
@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { Log.e(String.valueOf(error.getErrorCode()), error.getDescription().toString()); view.loadDataWithBaseURL( "file:///android_asset/", html, "text/html","utf-8", null ); }
@TargetApi(android.os.Build.VERSION_CODES.M) @Override public 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()); }
@TargetApi(android.os.Build.VERSION_CODES.M) @Override public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError err) { // redirect to deprecated method, so we can use it in all SDK versions onReceivedError(view, err.getErrorCode(), err.getDescription().toString(), req.getUrl().toString()); }
@Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { //Handle the error super.onReceivedError(view, errorCode, description, failingUrl); } @TargetApi(Build.VERSION_CODES.M) @Override public void onReceivedError(WebView view, WebResourceRequest req, WebResourceError rerr){ onReceivedError(view, rerr.getErrorCode(), rerr.getDescription().toString(), req.getUrl().toString()); }
webView.setWebViewClient(new WebViewClient() { @SuppressWarnings("deprecation") @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { if(errorCode == 404){ Log.d("Webview", "Invalid URL: "+url); } else if(errorCode == 500){ Log.d("Webview", "Internal Server error: "+url); } } @TargetApi(android.os.Build.VERSION_CODES.M) @Override public 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()); } });
webView.setWebViewClient(new WebViewClient() { @SuppressWarnings("deprecation") @Override public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { // TODO Auto-generated method stub super.onReceivedError(view, errorCode, description, failingUrl); webView .loadData( "<div>Please check your internet connection.</div>", "text/html", "UTF-8"); } @TargetApi(android.os.Build.VERSION_CODES.M) @Override public 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()); } });
@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { handleError(error.getErrorCode());
@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { if (Build.VERSION.SDK_INT>=23) { ProWebResourceError webResourceError = new ProWebResourceError(error.getDescription(), error.getErrorCode()); boolean redir = false; if (Build.VERSION.SDK_INT>=24) redir = request.isRedirect(); ProWebResourceRequest resourceRequest = new ProWebResourceRequest(request.getMethod(), request.getRequestHeaders(), request.getUrl(), request.hasGesture(), request.isForMainFrame(), redir); if (proClient != null) proClient.onReceivedError(ProWebView.this, resourceRequest,webResourceError); } }