0
以下のコードはエラー404の生成時に指定されたリンクにリダイレクトされず、エラーページを表示しています。親切にも下のコードを見てください。Webビューでエラー404が生成されました - 目的のページにリダイレクトされません
@Override
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
//Log.e(TAG," Error occured while loading the page at Url"+ failingUrl+"." +description);
if (errorCode == 404) {
// show Alert here for Page Not found
view.loadUrl("http://google.com");
} else {
Intent intent = new Intent(MainActivity.this, noconnection.class);
intent.putExtra("a", "mainactivity is source");
startActivity(intent);
Toast.makeText(getApplicationContext(), "Error occured, please check network connectivity", Toast.LENGTH_SHORT).show();
super.onReceivedError(view, errorCode, description, failingUrl);
}
}
エラーログ:
05-14 09:54:36.655 5673-5673/com.hare.pat E/SysUtils: ApplicationContext is null in ApplicationStatus
05-14 09:54:36.885 5673-5673/com.hare.pat E/chromium: [ERROR:browser_gpu_channel_host_factory.cc(258)] Failed to init browser shader disk cache.
05-14 09:54:37.026 5673-5673/com.hare.pat E/libEGL: validate_display:255 error 3008 (EGL_BAD_DISPLAY)
まだ同じで、リダイレクトしていません – Observer
デバッガポイントをそこに置いて、どのようなエラーコード値を取得できますか? – Santosh
あなたはhttp://stackoverflow.com/questions/34626377/android-webview-error-failed-to-init-browser-shader-disk-cacheとhttp://stackoverflow.com/questions/30013125/sysutils- applicationcontext-null-in-applicationstatus-webview ...私は 'errorCode == 404'以外の問題があると思います。 – Santosh