I am writing an Activity. It is supposed to display some view and play a sound. Everything is great, except for…
I am not sure where to put the code to play sound.
Currently I am playing it in onCreate() method of Activity, but the sound starts playing before Activity transition is complete. I would very much like the sound to play after the transition is complete and entire view is visible.
Is there any method that I can override/any Listener that I can implement, that gets called after the transition is complete? Is there any way to know the duration of transition, so I can simply postDelayed(Runnable action, long delayMillis) on View?
I am writing an Activity. It is supposed to display some view and play
Share
Did you try to put your code for playing sound in
onResume()? Because it gets called when Activity is in foreground.From Docs,
onResume() –