I made a button for Android that rotates on click, but when I set a button and new activity, when I click it's just set me to new activity.
I need just this: when I click on that button, first to do animation e.g. rotate, then to execute a new activity. Here is my code:
ImageButton pandaButton2 = (ImageButton) findViewById(R.id.pandaButton2);
pandaButton2.setOnClickListener(new OnClickListener(){
public void onClick(View v){
v.startAnimation(pandarotate);
startActivity(new Intent("com.example.threepandas.MENU"));
}
});
You can set
animation listener
, when finishanimation
start youractivity
. Please refer this linkExample code (must update based on your purpose):
Here is the solution I use for this problem (got it from the Google I/O App Source Code on Github)
insert a delay for the length of the animation after the animation starts and before the activity starts