Android examples for android.animation:Animator
cancel On Destroy Activity with Animator
//package com.java2s; import android.animation.Animator; import java.util.HashSet; public class Main { static HashSet<Animator> sAnimators = new HashSet<Animator>(); static Animator.AnimatorListener sEndAnimListener = new Animator.AnimatorListener() { public void onAnimationStart(Animator animation) { }//from w w w. ja va 2 s.c o 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); } }