Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SetProgressBarIndeterminateVisibility lack of understanding

Tags:

android

If I request a progress dialog like this in my main Activity then it is displayed as expected:

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

But if I set the visibility to "false", and then reset it to "true" inside the called procedure in which I want to deploy it, nothing is displayed. Moving the requestWindowFeature to the procedure causes an exception. How should I be doing this?

like image 276
SirHowy Avatar asked Sep 06 '11 10:09

SirHowy


1 Answers

You need to call requestWindowFeature() only once, in onCreate(), before you call setContentView(). Then you can use setProgressBarIndeterminateVisibility(true|false) to show or hide the progress indicator from anywhere in the activity (as long as it is on the UI thread, of course).

like image 190
Nikolay Elenkov Avatar answered Nov 19 '22 08:11

Nikolay Elenkov