Two animations one by one

I want to make 2 animations by activity for 2 images, and I want to do this with two conditions:
1. I want to start the animation after the operation is completed to load on the page, so instead of putting the animation code in onCreate, I put it under onResume, this is normal? Is there a better way to do this?

2. I want the second animation to start only after the completion of the first animation ...

thank

+3
source share
3 answers
+1

API, , AnimationSet AnimatorSet. , View , View.onAnimationStart() View.onAnimationFinish(). .

+1
        public class SplashActivity extends Activity{

        Animation FadeInanimation, FadeOutanimation;
        ImageView img;

        @Override
            public void onCreate(Bundle savedInstanceState) {
                super.onCreate(savedInstanceState);
                img= (ImageView) findViewById(R.id.img);
                //Your Code Block....

                FadeInanimation = AnimationUtils.loadAnimation(this,R.anim.image_fadein);
                //FadeInanimation.setRepeatCount(Animation.INFINITE);
                //FadeInanimation.setRepeatMode(Animation.RESTART);
                FadeInanimation.setAnimationListener(FadeInAnimationListener);

                FadeOutanimation = AnimationUtils.loadAnimation(this,R.anim.image_fadeout);
                //FadeOutanimation.setRepeatCount(Animation.INFINITE);
                //FadeOutanimation.setRepeatMode(Animation.RESTART);
                FadeOutanimation.setAnimationListener(fadeOutAnimationListener);

                img.startAnimation(FadeInanimation);
            }
    AnimationListener FadeInAnimationListener = new AnimationListener() {

            @Override
            public void onAnimationStart(Animation animation) {
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }

            @Override
            public void onAnimationEnd(Animation animation) {
                plane.startAnimation(FadeOutanimation);
            }
        };
    }
0
source

All Articles