Reputation: 40336
I have a ProgressBar and a VideoView both inside a RelativeLayout, with the ProgressBar floating above the VideoView in z-order (after it in the XML). The ProgressBar is indeterminate. When I switch video sources, I display the ProgressBar until the new video is playing, by setting its visibility to View.VISIBLE. I am doing this in the UI thread.
But my ProgressBar doesn't display immediately, although my logging statement (also in the UI thread, immediately before the setVisibility() call) occurs immediately. It takes a few (2 or 3) seconds. I have tried many things to make the ProgressBar display immediately and have run out of ideas.
How can I make the ProgressBar appear immediately?
Upvotes: 0
Views: 862
Reputation: 11053
Possibly try invalidating the complete view or do setContentView(R.layout.abc);
What I do in similar cases also is to start the subsequent code with a scheduler so that the UI screen update has time to update and does not get pushed back in priority. Even 0.5 secs are often enough if you can do this in your code...?
Upvotes: 1