Android ImageView Set loadAnimation(ImageView imageView, Animation animation, int animationResource)

Here you can find the source of loadAnimation(ImageView imageView, Animation animation, int animationResource)

Description

Load animation for the imageview.

Parameter

Parameter Description
imageView the image view
animation the animation
animationResource the animation resource

Declaration

public static void loadAnimation(ImageView imageView,
        Animation animation, int animationResource) 

Method Source Code

//package com.java2s;

import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;

public class Main {
    /**//w ww . j  av  a2s.c o m
     * Load animation for the imageview.
     * 
     * @param imageView
     *            the image view
     * @param animation
     *            the animation
     * @param animationResource
     *            the animation resource
     */
    public static void loadAnimation(ImageView imageView,
            Animation animation, int animationResource) {
        if (imageView == null)
            return;
        if (animation == null && animationResource != 0)
            animation = AnimationUtils.loadAnimation(
                    imageView.getContext(), animationResource);
        if (animation == null) {
            imageView.setAnimation(null);
            return;
        }

        imageView.startAnimation(animation);
    }
}

Related

  1. swapImages(ImageView src, ImageView dst)
  2. loadScaledPicture(String image_path, ImageView target)