title: Managing Animator lifecycle from within custom view in custom list adapter
body: <p>I have a custom view which automatically animates. It uses an <code>AnimatorSet</code> which calls <code>Animator.start()</code> in <code>onAnimationEnd()</code> in order to repeat endlessly. This is automatically started when the view is created.</p>
  
  <p>These views are used in a <code>ListAdapter</code> (actually a <code>SackOfViewsAdapter</code> so there is no recycling going on). So it's important to manage when to cancel (or pause) the animation.</p>
  
  <p>Maybe the animator should be registered with the adapter and then the <code>Activity</code> should call some method on that adapter to cancel any animations?</p>
  
  <p>Another idea is to check, in <code>onAnimationEnd()</code> whether the <code>View</code> <code>isShowing()</code> (i.e. don't restart animation if not showing) but then this would cause issues when the <code>View</code> comes back into view.</p>
  
  <p>This seems a little hacky to me, so I'm interested if there are better solutions.</p>
  
  <p>Also, what happens if an animator is paused?  I guess it will not be garbage collected?</p>