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

  • Home
  • SEARCH
  • 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 6620049
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T21:02:59+00:00 2026-05-25T21:02:59+00:00

My code below loads a progress dialogue into webview on the initial load but

  • 0

My code below loads a progress dialogue into webview on the initial load but I’d like it to appear every time webview is loading a URL!

I think I need to use onpagestarted() before the progressbar but I’m a bit of a noob at all this and having trouble getting it working. Can anyone advise please?

    //need to set progress bar condition here!

    progressBar = ProgressDialog.show(MyActivity.this, "Loading title", "Loading...");

    myWebView.setWebViewClient(new WebViewClient() {

         public void onPageFinished(WebView view, String url) {
             Log.i(TAG, "Finished loading URL: " +url);
             if (progressBar.isShowing()) {
                 progressBar.dismiss();
             }
         }

    });
    //web site load
    myWebView.loadUrl("http://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-05-25T21:03:00+00:00Added an answer on May 25, 2026 at 9:03 pm
    boolean loadingFinished = true;
    boolean redirect = false;
    
    mWebView.setWebViewClient(new WebViewClient() {
    
       @Override
       public boolean shouldOverrideUrlLoading(WebView view, String urlNewString) {
           if (!loadingFinished) {
              redirect = true;
           }
    
       loadingFinished = false;
       webView.loadUrl(urlNewString);
       return true;
       }
    
       @Override
       public void onPageStarted(WebView view, String url) {
            loadingFinished = false;
            //SHOW LOADING IF IT ISNT ALREADY VISIBLE  
        }
    
       @Override
       public void onPageFinished(WebView view, String url) {
           if(!redirect){
              loadingFinished = true;
           }
    
           if(loadingFinished && !redirect){
             //HIDE LOADING IT HAS FINISHED
           } else{
              redirect = false; 
           }
    
        }
    });
    

    As shown here: How to listen for a WebView finishing loading a URL?

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

Sidebar

Related Questions

I'd like to take XML in the format below and load each code record
I am currently using the code below to load images but I want to
In the code below I'm trying to load some images and put them in
Afternoon all, Using the code below I'm trying to load what is render by
The code below works. But if I comment out the line Dim objRequest As
I have the code below on a social network site, it loads a file
I have the code below at the moment. When the form loads, a ball
I have a loading image that works using the code below. It shows the
In my code below, I have a function that asynchronously loads all files necessary
Update: I have tried Sheldon's code below but I have struck a couple of

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.