package vargas_project.market;
import android.animation.Animator;
import android.animation.AnimatorInflater;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.app.Activity;
import android.os.Bundle;
import android.widget.ImageView;
public class MainActivity extends Activity {
AnimatorSet set;
ImageView imageView;
int imageResources[]={R.drawable.rosvil, R.drawable.cool_mart, R.drawable. el_pueblo, R.drawable. peri};
int index=0;
protected void onCreate(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity1);
imageView=(ImageView)findViewById(R.id.imageview);
set=(AnimatorSet)AnimatorInflater.loadAnimator(MainActivity.this, R.animator.slideshow);
set.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationCancel(Animator animation) {
super.onAnimationCancel(animation);
}
public void onAnimationEnd(Animator animator){
// ANIMATE THE NEXT IMAGE
if (index < imageResources.length) {
imageView.setImageResource(imageResources[index]);
index++;
set.start();
}
}
});
// START THE ANIMATION
set.start();
}
}