start/stop animation - Android User Interface

Android examples for User Interface:View Animation

Description

start/stop animation

Demo Code


//package com.java2s;

import android.graphics.drawable.AnimationDrawable;

import android.graphics.drawable.Drawable;

public class Main {
    /**//w  w  w. j ava 2  s. c o  m
     * start/stop animation
     *
     * @param d
     * @param start
     */
    static public void startDrawableAnimation(Drawable d, boolean start) {
        if (d instanceof AnimationDrawable) {
            if (start) {
                ((AnimationDrawable) d).start();
            } else {
                ((AnimationDrawable) d).stop();
            }
        }
    }
}

Related Tutorials