android - Imageview dosn't update -
I want to change the image view 3 times in a short time. I want to set this image, Sheldon "Boxing" Say, change the image directly after the audio is complete. And then I want to do this for the second time. Note that the first image is already set before calling this function:
sound = MediaPlayer.create (this, R.raw.bazinga); Sound.start (); Page.setImageResource (R.drawable.counttotwofirst); While (sound.isPlaying ()) {} sound.start (); Page.setImageResource (R.drawable.counttotwosecond); While (sound.isPlaying ()) {} sound.release (); Page.setClickable (true);
I have invalid (); Tried to use
, but he could not work.
Is anybody forced to update or at least the image view has been updated? If updates in image views take time? What other footage should I use instead?
BR
Think again that the design is a little bit. I'm guessing that you're running that code on your app's main (UI) thread. The problem is that although you are changing image processing, then you are blocking the UI thread (for a while) in the loop, so the UI updates are not displayed until after your full function returns. Some more pieces are needed to get the sound / animation effect. Create a background thread to run sound loading / playback, possibly from top of my head so that on the UI thread In addition, instead of sitting in the loop for some time () until the sound is over, it would be better to inform the callback that playback has completed (take a look at MediaPlayer :: setOnCompletionListener).
Comments
Post a Comment