@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { waitText.setVisibility(View.GONE); webView.setVisibility(View.GONE); Log.d(TAG, "onReceivedError : " + "Request : " + request); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Log.e( TAG, "onReceivedError : " + "Error Code : " + error.getErrorCode() + " : Error Desc : " + error.getDescription()); } Snackbar.make(webView, getString(R.string.login_error), Snackbar.LENGTH_INDEFINITE) .setActionTextColor(getResources().getColor(R.color.teal5)) .setAction( android.R.string.ok, new View.OnClickListener() { @Override public void onClick(View v) { finish(); } }) .show(); }
@Override public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error) { Snackbar.make(rootView, error.getDescription(), Snackbar.LENGTH_INDEFINITE) .setAction( "Reload", new View.OnClickListener() { @Override public void onClick(View view) { loadWebUrl(urlToLoad); } }) .show(); super.onReceivedError(view, request, error); }