tags:

views:

3408

answers:

2

I know that the following code should show and hide a tiny circular progress bar with the following code in Android:

requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
setProgressBarIndeterminateVisibility(true);
setProgressBarIndeterminateVisibility(false);

The problem is that I am using a TabHost and I need to be able to do this from one of the "child" activities. Is there any way I can go about doing this?

I found this question on the intarwebs but as you can see, it went unanswered.

+5  A: 

And I found the answer. In your parent activity, before you do anything, you need to do the requestWindowFeature call, and then in your child activity you call getParent().setProgressBarIndeterminateVisibility(true/false);

MattC
Thanks -- this is a really useful and unobtrusive way to show the usre that something is happening.
hwrdprkns
Thank you, my hero :)
droidgren
+1  A: 

Just for completeness:

If the task is running in a different thread other than Main ui thread, you can do:

    this.runOnUiThread(new Runnable() {
        public void run() {
            getParent().setProgressBarIndeterminateVisibility(mToggleIndeterminate);
        }
    });
droidgren