I have the following animation set in onClick. I am trying to start my activity after the animation is done, but it isn't working.
CODE
final ImageView iv1 = (ImageView) findViewById(R.id.imageView1);
iv1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
Animation anim = AnimationUtils.loadAnimation(MainActivity.this, R.anim.animation);
iv1.startAnimation(anim);
Intent i = new Intent();
i.setClass(MainActivity.this, P2.class);
startActivity(i);
}
});
QUESTION
How do I wait for the animation to complete before starting my activity?