I’m new to Android development, I have created an animation which I have associated with a button onClick action however the animation doesn’t seem to complete before the next command is executed. I know the animation works because if I comment out the openWallet() command I can watch it run as intended. Any ideas how I can make sure the animation completes before openWallet() is executed? openWallet() loads a different xml layout so I suspect the animation might be going on in the background?
private Button useButton;
private Animation buttonPulseAnimation = null;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.front_portrait);
useButton = (Button) findViewById(R.id.icon_image);
buttonPulseAnimation = AnimationUtils.loadAnimation(this, R.anim.button_pulse);
useButton.startAnimation(buttonPulseAnimation);
useButton.setOnClickListener(new View.OnClickListener(){
public void onClick(View v){
useButton.startAnimation(buttonPulseAnimation);
openWallet();
}
});
set animation listener and
onAnimationEnddo your next task: