¿Cómo iniciar la animación inmediatamente después de onCreate?
Estoy siguiendohttp: //developer.android.com/guide/topics/graphics/view-animation.html#frame-animatio con cambios menores. He decidido hacer el bucle de animación y quiero que comience desde el principio.
Mi animación está en drawable / listening.xml:
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item
android:drawable="@drawable/l_01"
android:duration="200" />
<item
android:drawable="@drawable/l_02"
android:duration="200" />
<item
android:drawable="@drawable/l_03"
android:duration="200" />
</animation-list>
y mi código de inicio:
@Override public void onWindowFocusChanged(boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
animImg = (ImageView)findViewById(R.id.listen_anim);
animImg.setBackgroundResource(R.drawable.listening);
anim = (AnimationDrawable) animImg.getBackground();
anim.start();
};
Todo lo que veo es el primer fotograma y ninguna otra imagen.