Question Detail

I want to show Toast on animation End Android Animation Listener

6 years ago Views 1341 Visit Post Reply

What is Animation lifecycle in android? How can I Use animation different states?
on Animation End I want a toast. AnimationListener not showing me anything for Lifecycle.


Thread Reply

Anonymous

- 6 years ago

You have to code on Animation Object not on Your View's Object  you can easily track animation States

 

icon_ImageView.setOnClickListener(new View.OnClickListener() {
    @Override
    public void onClick(View v) {
        icon_ImageView.startAnimation(logoMoveAnimation);
        logoMoveAnimation.setAnimationListener(new Animation.AnimationListener() {
            @Override
            public void onAnimationStart(Animation animation) {
               //here code for on Start ANimation
            }

            @Override
            public void onAnimationEnd(Animation animation) {
            Toast.makeText(getBaseContext(), "Animation End", Toast.LENGTH_SHORT).show();
            }

            @Override
            public void onAnimationRepeat(Animation animation) {

            }
        });
    }
});