package com.eni.android.animation;

import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView;

public class Ch8_FrameAnimationActivity extends Activity {
    /** Called when the activity is first created. */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        
        ImageView marketImage = (ImageView) findViewById(R.id.image);
        marketImage.setBackgroundResource(R.anim.frame_animation);

        final AnimationDrawable marketAnimation = (AnimationDrawable) marketImage.getBackground();
        marketImage.post(new Runnable() {
            public void run() {
                if ( marketAnimation != null ) marketAnimation.start();
              }
        });
    }
}