How to start an activity after the animation has ended. I have added android:oneshot="true" in the xml but how to start a new activity after this animation has stopped.I have attached the entire code below. Please let me know how to start new activity.If I use this code without showing my animation it goes to the another acitivity.
public class MainActivity extends Activity {
ImageView iv;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public void onWindowFocusChanged (boolean hasFocus) {
super.onWindowFocusChanged(hasFocus);
AnimationDrawable animation = (AnimationDrawable) iv.getBackground();
if(hasFocus) {
animation.start();
startActivity(new Intent(MainActivity.this,second.class));
} else {
animation.stop();
}
}
public void onStart() {
{
super.onStart();
iv = (ImageView)findViewById(R.id.imageView1);
iv.setBackgroundResource(R.animator.animation);
}
}
}