I am having a common problem doing animationdrawable in Android. I wanted to start an animation when the Activity starts, in the onCreate() method, but as many people have found, it doesn't work.
I have read lots of advice but nothing seems to work for me. If I start the animation in onClick() it works, it requires user input, not starting immediately.
I tried starting it in a separate thread in onCreate() but that doesn't work either. I read here:
http://code.google.com/p/android/issues/detail?id=1818
but none of the advice worked, or I couldn't understand it.
Can someone help?
I've faced similar problems, and switched to overriding onWindowFocusChanged() instead of onCreate() and onResume():
public void onWindowFocusChanged(boolean hasFocus)
{
if (hasFocus)
{
animation.start();
}
else
{
animation.stop();
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With