Android examples for android.animation:Animator
on Destroy Activity Animator
//package com.java2s; import android.animation.Animator; import java.util.HashSet; public class Main { static HashSet<Animator> sAnimators = new HashSet<Animator>(); public static void onDestroyActivity() { HashSet<Animator> animators = new HashSet<Animator>(sAnimators); for (Animator a : animators) { if (a.isRunning()) { a.cancel();/* w w w. j a v a2s .c om*/ } else { sAnimators.remove(a); } } } }