I have an animation that is to be displayed on click of an image view and finish the animation before going to another activity.I have been trying to do this.
Here is my code :
public void myAnimation()
AnimationDrawable animation;
animation = new AnimationDrawable();
animation.addFrame(
getResources().getDrawable(R.drawable.large_ring_monotone),
1000);
animation.addFrame(getResources()
.getDrawable(R.drawable.large_ring_eal), 1000);
animation.addFrame(
getResources().getDrawable(R.drawable.large_ring_blue), 1000);
animation.addFrame(
getResources().getDrawable(R.drawable.large_ring_monotone),
1000);
animation.setOneShot(true);
img_big_2_back.setOnClickListener(new OnClickListener){
img_big_2_back.setBackgroundDrawable(animation);
try {
animation.start();
Thread.sleep(3000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
Intent i1 = new Intent(MAinACtivity.this,SecondActivity.class);
startActivity(i1);
});
}
Can any one let me know where i am going wrong