on Destroy Activity Animator - Android android.animation

Android examples for android.animation:Animator

Description

on Destroy Activity Animator

Demo Code


//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);
            }
        }
    }
}

Related Tutorials