webPage not available
Web ビューでメッセージをクリアできません。
book.clearView()
inonReceivedError
メソッドは をクリアしていませんが、読み込みに失敗したときWebView
にまだが表示されています。助けていただければ幸いです。webPage not available message
WebView
final WebView book = (WebView)findViewById(R.id.book);
//book.setBackgroundColor(Color.parseColor("#123456"));
book.setBackgroundColor(0);
book.setBackgroundResource(R.drawable.pnr)
WebSettings settings = book.getSettings();
settings.setJavaScriptEnabled(true);
book.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY);
final AlertDialog alertDialog = new AlertDialog.Builder(this).create();
final ProgressDialog dialog =ProgressDialog.show(AboutApp.this,null, "Loading...");
book.setWebViewClient(new WebViewClient(){
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
// TODO Auto-generated method stub
//dialog = ProgressDialog.show(AboutApp.this,null, "Loading...");
super.onPageStarted(view, url, favicon);
}
@Override
public void onPageFinished(WebView view, String url) {
// TODO Auto-generated method stub
if(dialog.isShowing()){
dialog.dismiss();
}
super.onPageFinished(view, url);
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
// TODO Auto-generated method stub
//Log.i(TAG, "Processing webview url click...");
view.loadUrl(url);
return true;
}
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
// Log.e(TAG, "Error: " + description);
//Toast.makeText(activity, "Oh no! " + description, Toast.LENGTH_SHORT).show();
book.clearView();
alertDialog.setTitle("Error");
alertDialog.setMessage("Sorry, This particular service is unavailable at this time.Please try again later");
alertDialog.setButton("OK", new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int which) {
finish();
return;
}
});
alertDialog.show();
}
});
book.loadUrl("www.google.com");