Some frames are not showing in Frame Animation
- by Aju Vidyadharan
I am doing a frame to frame animation. My problem is I have given around 10 drawable images in my anim xml. But only first two and last two is showing not all the images. I am doing a translation also on this image.After translation only frame animation starts.Translation is happening and frame animation also happening but it is not showing all the frames. Here is my anim xml. only frog_01 and frog_02 is showing.
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true" >
<item
android:drawable="@drawable/frog_01"
android:duration="70"/>
<item
android:drawable="@drawable/frog_02"
android:duration="70"/>
<item
android:drawable="@drawable/frog_03"
android:duration="70"/>
<item
android:drawable="@drawable/frog_04"
android:duration="70"/>
<item
android:drawable="@drawable/frog_05"
android:duration="70"/>
<item
android:drawable="@drawable/frog_04"
android:duration="70"/>
<item
android:drawable="@drawable/frog_03"
android:duration="70"/>
<item
android:drawable="@drawable/frog_02"
android:duration="70"/>
<item
android:drawable="@drawable/frog_01"
android:duration="70"/>
</animation-list>
Here is the code which I am using for the translation and Frame animation...
public void frogAnim() {
frogView.clearAnimation();
final TranslateAnimation fslide2 = new TranslateAnimation(10, 65, 0, 0);
fslide2.setDuration(400);
fslide2.setFillAfter(true);
fslide2.setAnimationListener(fanimationListener1);
frogView.startAnimation(fslide2);
c = false;
}
AnimationListener fanimationListener1 = new AnimationListener() {
public void onAnimationEnd(Animation arg0) {
c = true;
frogView.setBackgroundResource(R.drawable.frog_movement);
frogFrameAnimation = (AnimationDrawable) frogView.getBackground();
frogFrameAnimation.start();
playAudioFileListener(R.raw.frog, player);
CountDownTimer count = new CountDownTimer(200, 700) {
@Override
public void onTick(long millisUntilFinished) {
}
@Override
public void onFinish() {
frogFrameAnimation.stop();
titileAnimMusic(R.drawable.frog_title,
R.anim.alpha_fade_in1, R.raw.vo_child_frog, player);
}
};
count.start();
}
public void onAnimationRepeat(Animation animation) {
// TODO Auto-generated method stub
}
public void onAnimationStart(Animation animation) {
}
};