Actionbar Progressbar visibility not reacting

I put a progress bar (circular) in the action bar with the following code:

<item
    android:id="@+id/menu_progress"
    android:actionLayout="@layout/action_progress"
    android:menuCategory="container"
    android:showAsAction="always">
</item>

and in the java code:

public void onProgressChanged(WebView view, int progress) 
        {  
            if (progress<100)
            {
               progressBar.setVisibility(ProgressBar.VISIBLE);
            }
            else if (progress==100)
            {
               progressBar.setVisibility(ProgressBar.GONE);
            }
            progressBar.setProgress(progress);  
        }   

However, the progress bar will not disappear even after the webpage has loaded, and I have no clue why.

Can anyone help? Thank you.

Answers


progressBar.setVisibility(view.GONE);

or

progressBar.setVisibility(2);

http://developer.android.com/reference/android/view/View.html#attr_android:visibility


It should be better if you put the code in the onPostExcecute() method. You gain performance.


Need Your Help

Service Layer Pattern - Could we avoid the service layer on a specific case?

design-patterns

we are trying to implement an application using the Service Layer Pattern cause our application needs to connect to other multiple applications too, and googling on the web, we found this link of a

Getting Json to a model object

scala playframework playframework-2.0

I need to get Json to my model but i have problems(i am beginner).