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 8353225
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T09:11:44+00:00 2026-06-09T09:11:44+00:00

My app had webview and i add progress dialog for display loading until web

  • 0

My app had webview and i add progress dialog for display loading until web finish loading. i search in google and got good solution

wv.setWebChromeClient(new MyWebChromeClient());
wv.setWebViewClient(new MyWebViewClient());
wv.loadUrl("http://www.google.com"); 

     private class MyWebViewClient extends WebViewClient {
        @Override
         public boolean shouldOverrideUrlLoading(WebView view, String url) 
        {
            view.loadUrl(url);
            return true;
        }

        @Override
     public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
            alertdialog.setTitle("Error");
            alertdialog.setMessage(description);
            alertdialog.setButton("OK", new DialogInterface.OnClickListener() {
             public void onClick(DialogInterface dialog, int which) {
                 //return;
                finish();
             }
         });
            alertdialog.show();
     }
    }


    private class MyWebChromeClient extends WebChromeClient {

        @Override
        public void onProgressChanged(WebView view, int progress) {
            progressDialog.show();
            progressDialog.setProgress(0);
            activity.setProgress(progress * 1000);

            progressDialog.incrementProgressBy(progress);

            if(progress == 100 && progressDialog.isShowing())
                progressDialog.dismiss();
        }

    }

but my problem is , how to make progressdialog just appear once after i launch it, because right now if i click example like picture (in google.com) progress dialog will appear again.

  • 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-09T09:11:46+00:00Added an answer on June 9, 2026 at 9:11 am
    this.getWindow().requestFeature(Window.FEATURE_PROGRESS);
                setContentView(R.layout.info);
    
                mProgressDialog = new ProgressDialog(this);
                mProgressDialog.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
                mProgressDialog.setMessage("Please wait...");
                mProgressDialog.setCancelable(false);
                mProgressDialog.setMax(100);
                mProgressDialog.show();
    
                WebView webView = (WebView) findViewById(R.id.webview);
                webView.setVisibility(View.VISIBLE);
                webView.getSettings().setJavaScriptEnabled(true);
    
                webView.setWebChromeClient(new WebChromeClient() {
                    public void onProgressChanged(WebView view, final int progress)
                    {
                        activity.setTitle("Loading...");
                        activity.setProgress(progress * 100);
                        mProgressDialog.setProgress(progress );
    
    
    
    
                        if(progress == 100)
                        {
                            activity.setTitle(R.string.app_name);
                            mProgressDialog.dismiss();
                        }
    
                    }
                });
    
                webView.setWebViewClient(new WebViewClient() {
                    @Override
                    public void onReceivedError(WebView view, int errorCode, String description, String failingUrl)
                    {
                    }
    
                    @Override
                    public boolean shouldOverrideUrlLoading(WebView view, String url)
                    {
                        view.loadUrl(url);
                        return true;
                    }
                });
    
                webView.loadUrl("http://www.google.com");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My android webview app never had scrolling issues until the most recent version, Jelly
My app had been chugging along fine on the Android market until last night
I use a WebView to display some internet content on one of our app's
I added a WebView to my app and I'm loading a page into it
I inherited an Intraweb app that had a 2MB text file of memory leaks
I had this app using 1.9.2 and rails 3.2 and today I changed the
So I had an app running Phonegap 1.4.0 (don't ask), I decided to upgrade
I recently had my app certified (first time!) but not automatically published. The game
I just had my app crash and now after alot of work its back
Me and My friend had an app idea. I have been working on the

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.