I have the following XML file to define my frame animation:
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="@drawable/youme_blink_frame_0000" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0001" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0002" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0003" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0004" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0005" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0006" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0007" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0008" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0009" android:duration="40" />
<item android:drawable="@drawable/youme_blink_frame_0010" android:duration="40" />
</animation-list>
Then I have the following code:
Animation mAnim = AnimationUtils.loadAnimation(this, R.anim.blink);
mAnim.setAnimationListener(this);
ImageView img = (ImageView)findViewById(R.id.animationImage);
img.clearAnimation();
img.setAnimation(mAnim);
img.startAnimation(mAnim);
This code generates an exception with the error “animation file not found”.
Is it that a frame animation is not considered to be an animation or I am doing something wrong?
Thanks,
Simon
Frame by Frame animation is a AnimationDrawable not Animation. what you do is using it as animation and that is the cause of the exception there is no animation file with that name there is drawable file.
to use AnimationDrawable use this code snippet
for more info about AnimationDrawable please refer to the documentation