Rohan K
Rohan K

Reputation: 1618

How to use Rotating Progress Bar?

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.

Upvotes: 2

Views: 3565

Answers (3)

hutu_cn
hutu_cn

Reputation: 1

Drawable d = yourActivity.this.getResources().getDrawable(android.R.drawable.ic_dialog_alert);
d.setBounds(progressbar.getIndeterminateDrawable().getBounds());
progressbar.setIndeterminateDrawable(d);

Upvotes: 0

Samuh
Samuh

Reputation: 36484

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);
    }
 });

Upvotes: 3

DeRagan
DeRagan

Reputation: 22920

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

Upvotes: 3

Related Questions