Code example for TimeAnimator

Methods: cancel, start

0
            stopAnimation(); 
            if (mAnim == null) {
                post(new Runnable() { public void run() {
                    reset(); 
                    startAnimation(); 
                } }); 
            } else { 
                mAnim.start();
            } 
        } 
 
        public void stopAnimation() { 
            if (mAnim != null) mAnim.cancel();
        } 
 
        @Override 
        protected void onDetachedFromWindow() { 
            super.onDetachedFromWindow(); 
            stopAnimation(); 
        }