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 know this is an old question, but I was having the same problem, but the answers weren't helping me. After spending hours working on it I finally found out that my problem was that I had added android:src="@drawable/myanimation" to the imageview container. Once I removed this the above answers worked. I think the animation was running but by setting the src the first image of the animation was on top of it, and thus I thought it wasn't playing.
android:src defined and is set to invisibleonCreate I set the imageview to visible and setBackgroundResource to my animation described in the XML fileonWindowFocusChanged I start the animation.