Reputation: 1794
public void startGameButtonClicked(View view) { final TextView shadow = (TextView) findViewById(R.id.main_menu_start_game_button_shadow);
final Animation animation = AnimationUtils.loadAnimation(this, R.anim.main_menu);
shadow.startAnimation(animation);
/** Ugly prototype pausing */
final long startTime = System.currentTimeMillis();
while ((System.currentTimeMillis() - startTime) < 600) {
Log.i("test", Boolean.toString(animation.hasEnded()));
}
final Intent intent = new Intent();
intent.putExtra(EXTRA_BUTTON_ID, START_GAME_BUTTON);
setResult(RESULT_OK, intent);
finish();
}
My animation has duration = 400, how can i pause everything except animation after calling shadow.startAnimation(animation); ? I asking becouse, as you can see - animation is set for button click action, which kills current activity, so animation isnt shown completely.
Upvotes: 1
Views: 1250
Reputation: 11541
You must define "pause everything" to get an answer for it.
What I'll propose is to implement AnimationListener in your Activity, and point it to the Animation. Then in onAnimationEnd() simply call finish().
Upvotes: 1