Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android RotateAnimation Completed

I am working on a RotateAnimation. I started to rotate the image but I want to know when animation completes. How will I know when the animation ends?

Below is my rotation image code.

RotateAnimation rotateanimation = new RotateAnimation(StartPoint,
                    EndPoint, Animation.RELATIVE_TO_SELF, 0.5f,
                    Animation.RELATIVE_TO_SELF, 0.5f);
            rotateanimation.setDuration(1000);
            rotateanimation.setRepeatCount(0);
            rotateanimation.setRepeatMode(Animation.REVERSE);
            rotateanimation.setFillAfter(true);
            rotateImage.setAnimation(rotateanimation);
            rotateanimation.start();
            relative.invalidate();
like image 593
user123456 Avatar asked Mar 25 '26 03:03

user123456


1 Answers

Use Animation Listener as:

implements animation listener in activity
and then :
*rotateanimation.setAnimationListener(MainActivity.this);
*after that you will find on
    public void onAnimationEnd(Animation animation)
{
//Toast here on animation ends
}

http://developer.android.com/reference/android/view/animation/Animation.AnimationListener.html
like image 156
Androider Avatar answered Mar 26 '26 15:03

Androider



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!