Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8431079
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T05:45:37+00:00 2026-06-10T05:45:37+00:00

Not able to clear webPage not available message in web view. book.clearView() in onReceivedError

  • 0

Not able to clear webPage not available message in web view.

book.clearView() in onReceivedError method is not clearing the WebView, still the webPage not available message is getting displayed when failed to load WebView,any help would be appreciated.

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");
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T05:45:39+00:00Added an answer on June 10, 2026 at 5:45 am

    We need to design our own html file , place that file under assests folder and using loadUrl() method load the html file. eg : book.loadUrl(“file:///android_asset/error.html”);

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am not able to make a clear decision on this one. I am
Not able to get a clear distinction between these concepts that are used very
I'm not able to find a clear explanation about the difference between ASP.NET Ajax
I'm not able to get a clear answer on my problem: I want to
Not able to download artifacts from central maven repository. <mirrors> <!-- mirror | Specifies
Not able to store all binary data values into sqlite3 table using QT. For
not able to get this, can someone help for this LINQ query? select col1,
Im not able to load the page with circlepageindicator. This is the xml <FrameLayout
I am not able to understand how to rotate the image. I am trying
Hi I am not able to capture the screen shot using selenium webdriver .

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.