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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T06:14:59+00:00 2026-06-12T06:14:59+00:00

I am having troubles getting this progress bar to work properly. can any body

  • 0

I am having troubles getting this progress bar to work properly. can any body help me with the source, is there something im missing?

 web = (WebView) findViewById(R.id.webview01);
        progressBar = (ProgressBar) findViewById(R.id.progressBar);
        web.setWebViewClient(new myWebClient());

        //ADDING THIS RESOLVED THE PROGRESS BAR ACTUALLY LOADING.
        web.setWebChromeClient(new WebChromeClient() {
        public void onProgressChanged(WebView view, int progress) {
        progressBar.setProgress(progress); } 
        });
        //ADDING THIS RESOLVED THE PROGRESS BAR ACTUALLY LOADING.

        WebSettings websettings = web.getSettings();
        websettings.setBuiltInZoomControls(true);
        websettings.setUseWideViewPort(true);
        websettings.setJavaScriptEnabled(true);
        websettings.setAllowFileAccess(true);
        websettings.setDomStorageEnabled(true);
        websettings.setLoadWithOverviewMode(true);
        websettings.setSavePassword(true);
        web.loadUrl("http://www.google.com");

Then Later in the code

    //Loading the Actual Webpage
public class myWebClient extends WebViewClient
{
    @Override
    public void onPageStarted(WebView view, String url, Bitmap favicon) {
        // TODO Auto-generated method stub
        super.onPageStarted(view, url, favicon);
        progressBar.setVisibility(View.VISIBLE);

    }

    @Override
    public boolean shouldOverrideUrlLoading(WebView view, String url) {
        // TODO Auto-generated method stub

        view.loadUrl(url);
        progressBar.setVisibility(View.VISIBLE);
        return true;

    }
    //web.setWebChromeClient(new WebChromeClient() {
    public void onProgressChanged(WebView view, int progress) {
         progressBar.setProgress(progress);

    }




    @Override
    public void onPageFinished(WebView view, String url) {
        // TODO Auto-generated method stub
        super.onPageFinished(view, url);

        progressBar.setVisibility(View.GONE);
    }

}

The webview itself works just fine, im just trying to have a horizontal loading bar, similar to browsers like dolphin, chrome, etc.

Here is the layout.

 <?xml version="1.0" encoding="UTF-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
 android:layout_width="fill_parent"
 android:layout_height="fill_parent"
 android:background="@drawable/bgapp"
 android:fadingEdge="horizontal"
 android:gravity="center"
 android:orientation="vertical" >

 <include
    android:id="@+id/inc_blue"
    android:layout_width="fill_parent"
    android:layout_height="50dp"
    layout="@layout/inc_enphase_bar_with_title_buttons" />

<ProgressBar
    android:id="@+id/progressBar"
    style="?android:attr/progressBarStyleHorizontal"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:minHeight="8dip" />

<WebView
    android:id="@+id/webview01"
    android:layout_width="fill_parent"
    android:layout_height="0dp"
    android:layout_weight="1.15"
    android:fadingEdge="vertical" >

</WebView>

Im not getting any errors or antying so no logcat, its just actually loading, it displays the progress bar when a webpage is loading but no animation or actually movement of loading.

  • 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-12T06:15:00+00:00Added an answer on June 12, 2026 at 6:15 am

    You should also set intermediate progress by using

    progressBar.setProgress(int);
    

    for the progress to be shown. All you are doing is showing and hiding the view

    Edit:
    Add below code.

       @Override
       public void onProgressChanged(WebView view, int progress) {
         progressBar.setProgress(progress);
       }
    

    Sorry you need a webchromeclient for this. So use like below. Put it just below

    web.setWebViewClient(new myWebClient());
    //add this below line
    web.setWebChromeClient(new WebChromeClient() {
       public void onProgressChanged(WebView view, int progress) {
            progressBar.setProgress(progress);
       }
     });
    

    Check WebView Doc, it has an example.

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

Sidebar

Related Questions

I am having trouble getting this to work so any help would be appreciated!
I'm having troubles getting this to work. Basically I have a python program that
So i've been having some troubles getting this effect to work. Here is an
i am having troubles getting my preg_replace to work for a certain string. This
I am having trouble getting this invisibilityOfElementLocated() method to work. Here is the code
Ok this seems so silly but I'm having some trouble getting this to work.
I'm having trouble getting any information to display from this query. Anyone know where
I am having some troubles getting some regex to work to remove some text,
I'm having troubles getting this right... I have a Core project with a common
I have been having troubles getting my makefiles to work the way I want.

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.