Java – Android View animation lifecycle

Android View animation lifecycle… here is a solution to the problem.

Android View animation lifecycle

I would like to ask if the animation is canceled when the View is destroyed, such as when the configuration changes.

I have animations with delays and callbacks. So I’m worried about whether the View Destroy callback will be executed afterward.

 view.animate()
     .setStartDelay(2000)
     .withEndAction(new Runnable() {
            @Override
            public void run() {
                do something
            }
        });

Solution

You can call anim.cancel(); You can also call anim.reset();

Quotehere

Related Problems and Solutions