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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T19:17:07+00:00 2026-05-25T19:17:07+00:00

This things sending me crazy. My app loads webview and shows a loading dialog

  • 0

This things sending me crazy. My app loads webview and shows a loading dialog on the initial load. I want the loading dialog to appear each time a link is clicked or each time webview is loading. This is not happening.

Eclipse tells me onPageStarted() is not used locally, although onPageFinished() works fine!?

Can anyone see what’s going wrong, I’ve pasted all my activity below:

   package com.jeh.myapp;

import android.app.Activity;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.KeyEvent;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.Window;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;

public class MyActivity extends Activity {

    WebView myWebView;
    public static final String TAG = "Main";
    public ProgressDialog progressBar; 
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        //Remove title bar as we already have it in the web app
        this.requestWindowFeature(Window.FEATURE_NO_TITLE);
        //Point to the content view defined in XML
        setContentView(R.layout.main);
        //Configure the webview setup in the xml layout
        myWebView = (WebView) findViewById(R.id.webview);
        WebSettings webSettings = myWebView.getSettings();
        //Yes, we want javascript, pls.
        webSettings.setJavaScriptEnabled(true);

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


        //Make sure links in the webview is handled by the webview and not sent to a full browser
        myWebView.setWebViewClient(new WebViewClient() {


            //this bit causes problems, if I add @Override here it says to remove, where as the current code marks onPageStarted yellow and says it's not used locally!? - yet onPageFinsihed() below works fine?
            public void onPageStarted(WebView view, String url, Bitmap favicon) {

                progressBar.show();
            }


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

        });
        //Load URL:
        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-25T19:17:08+00:00Added an answer on May 25, 2026 at 7:17 pm

    Easy.
    There are no

    void onPageStarted(WebView view, String url)
    

    method in a WebViewClient, simply use :

    @Override
    void onPageStarted(WebView view, String url, Bitmap favicon)
    

    These errors are easy to make and difficult to find. You should use @Override keyword wherever you know you’re overriding a method (which would have flagged an error in your case).

    Try to modify your source this way:

    //Make sure links in the webview is handled by the webview and not sent to a full browser
    myWebView.setWebViewClient(new WebViewClient() {
        @Override
        public void onPageStarted(WebView view, String url, Bitmap favicon) {
            progressBar.show();
        }
    
        @Override
         public void onPageFinished(WebView view, String url) {
             Log.i(TAG, "Finished loading URL: " +url);
             if (progressBar.isShowing()) {
                 progressBar.dismiss();
             }
         }
    
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have developed a control in C#. Among other things this control can popup
I've seen people doing things like this in their HTML: <!--[if IE]> <link rel=stylesheet
I've read conflicting things on this. From Wikipedia: Controller Processes and responds to events,
How would you integrate things like this in a RESTful design? Marking an email
I often see things like this in rails views: <% form_tag some_path do -%>
I can draw many things using this : NSString *imagePath = [[NSBundle mainBundle] pathForResource:@dummy2.png
I always forget how to do things like this. I have a database table
In documentation code I see some things like this: /* * @(#)File.java 1.142 09/04/01
Is there anything wrong with checking so many things in this unit test?: ActualModel
Many times when I read books related to CSS I see things like this

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.