0

I am using a RotationAnimation to rotate a custom view object (derived directly from View). The view object's onDraw() is called repeatedly during the animation, and then onAnimationEnd callback is called. In the callback I am updating the view's backing data object to record its new rotation.

The problem I am seeing is that the view object continues to have its onDraw() called after the onAnimationEnd callback has been called and has returned. This is a problem because, in the callback, I update values that cause the view to render its contents with a rotation. Since the animation is also still transforming the view, the end-result is that it briefly over-rotates before snapping back to the correct position as the rotation transform is removed.

So, if the animation causes the animated view's onDraw() to be called after onAnimationEnd is called, how can I determine when the animation has really finished so that I can update the backing object model at the appropriate time?

I'd be grateful for any help on this.

Andy Johnson
  • 7,938
  • 4
  • 33
  • 50

1 Answers1

0

For the benefit of anyone reading this question in the future, the solution to reliably detecting the end of the animation seems to be to override onAnimationEnd() on the View object being animated.

Further details can be found at https://stackoverflow.com/a/5110476/67316.

Community
  • 1
  • 1
Andy Johnson
  • 7,938
  • 4
  • 33
  • 50