So I want my animation to start as soon as the activity is created, but for some reason no matter what I try will get it to start. I can get it to start by having a click ev
I think you have to start the animation after initialization of the view in question is complete. You should be able to do something like:
final ImageView tweenImage = (ImageView) findViewById(R.id.imageView1);
tweenImage.setBackgroundResource(R.anim.cubicfacetween);
tweenImage.post(new Runnable() {
@Override
public void run() {
AnimationDrawable frameAnimation =
(AnimationDrawable) tweenImage.getBackground();
frameAnimation.start();
}
}
Edit - this question led me to believe that the onWindowFocusChanged method won't always work. It does seem simpler and is probably a better idea if it works for you.