SetProgressBarIndeterminateVisibility lack of understanding

If I request a run dialog similar to this in my main activity, then it will display as expected:

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

But if I set the visibility to "false" and then reset to "true" inside the called procedure in which I want to deploy it, nothing is displayed. Moving the requestWindowFeature method to a procedure throws an exception. How am I supposed to do this?

+6
source share
1 answer

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 action (if it will be in the user interface thread, of course).

+9
source

Source: https://habr.com/ru/post/896700/


All Articles