Android examples for android.animation:Animator
cancel On Destroy Activity Animator
//package com.java2s; import android.animation.Animator; import java.util.HashSet; public class Main { private static HashSet<Animator> sAnimators = new HashSet<Animator>(); static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { }/*from ww w .jav a 2 s .co m*/ public void onAnimationRepeat(Animator animation) { } public void onAnimationEnd(Animator animation) { sAnimators.remove(animation); } public void onAnimationCancel(Animator animation) { sAnimators.remove(animation); } }; public static void cancelOnDestroyActivity(Animator a) { sAnimators.add(a); a.addListener(sEndAnimListener); } }