text: Q:
  
  Does AnimationDrawable keep running in background?
  
  I have a custom view in Android which has uses an AnimationDrawable. If I have called AnimationDrawable.start() in my view, and I push the app to background without calling stop(), is it draining system resources in the background ?
  If yes, how should I detect the "view" coming to foreground/background ? I am trying to avoid splitting the code into activity, because I want the custom view to be self-sufficient in handling it's own lifecycle.
  EDIT: Please note that I understand that Activity.onPause and onResume calls can help me, but I don't want the consumers of my custom view to code for lifecycle methods - I want my custom view to take care of itself.
  
  A:
  
  To have the view handle this on its own, override onDetachedFromWindow() and stop the animation within that. You can check for if it is animating within the onDraw and start again if it has been stopped.
  
  