tags:

views:

58

answers:

2

Hi i'm using Rotating Progress Bar in my Android Music Plyer Application....I'm not able to stop it. While working with horizontal Progress bar i used handler to stop and start it. But while working with Rotating One, The progress bar goes into Infinite Loop.....

Can you please suggest method to stop the indefinite loop. Thanks in advance.

+1  A: 

How about using ProgressBar#dismiss() method?

EDIT: dismiss() is only for ProgressDialog. For ProgressBar you should toggle the Visibilty of the View.

If mHandler is a Handler bound to your UI thread and mProgress is your ProgressBar, you can have something like the following from inside the run method of your background thread:

 mHandler.post(new Runnable() {
    public void run() {
        mProgress.setVisibility(View.INVISIBLE);
    }
 });
Samuh
Thank you for super fast reply.Can you provide the handler code snippet where the dismiss method needs to be written.
Rohan K
Rahul is correct(+10 to him for pointing out this subtlety). A ProgressDialog is dismissed. A ProgressBar is just a view that can be made Visible/invisible/Gone.If mHandler is a Handler bound to UI thread you can say something like: mHandler.post(new Runnable() { public void run() { mProgress.setVisibility(View.INVISIBLE); } });
Samuh
+2  A: 

You can dismiss a ProgressDialog. A progressBar is just a view you can make set its visibility as visible or invisible based on your requirement

Rahul
thanks for pointing out the mistake!
Samuh
not a problem :)
Rahul