Load animation and set duration - Android Animation

Android examples for Animation:Animation Creation

Description

Load animation and set duration

Demo Code


//package com.java2s;
import android.content.Context;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;

public class Main {
    /**/*from   w w  w  .j a  v a  2 s. co  m*/
     * Load anim and set duration
     * 
     * @param anim
     * @param duration
     * @return
     */
    public static Animation loadAnimation(Context context, int anim,
            int duration) {
        Animation animation = AnimationUtils.loadAnimation(context, anim);
        animation.setDuration(duration);

        return animation;
    }
}

Related Tutorials