package com.eni.android.animations;

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

public class FrameAnimation extends Activity {

	@Override
	protected 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();
		          }
		    });
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.frame_animation, menu);
		return true;
	}

}
