Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.drawable.AnimationDrawable;
import android.view.View;

public class Main {
    /**
     * Start given animation on provided view.
     */
    public static void startAnimation(View view, int animationId) {
        view.setBackgroundResource(animationId);
        AnimationDrawable animationDrawable = (AnimationDrawable) view.getBackground();
        if (animationDrawable != null) {
            animationDrawable.start();
        }
    }
}