Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I stop an infinite animation on an ImageView, but let it complete its current cycle?

Tags:

android

I applied an infinite animation on an ImageView to indicate a running background thread in my app. When the thread finishes, I'm able to stop the animation by using clearAnimation(), but it snaps the ImageView back to its starting position, and I'd like the current animation cycle to complete (which is designed to gracefully end in its starting position). Is there a way to do this?

like image 751
wirbly Avatar asked Apr 24 '11 21:04

wirbly


1 Answers

Register an AnimationListener, and wait until onAnimationRepeat() to clear it. I haven't tried this, but I think it will work.

like image 83
CommonsWare Avatar answered Sep 30 '22 15:09

CommonsWare