I've been trying for a while to understand the Handlers thingy in order to pause a game for a few seconds.. no luck so far.
I was hoping if someone could walk me through or show me a complete method that can be adapted to my needs. which are: I have a pong like game, when the ball hit either sides of the screen, I want to pause for a few seconds to display the score, and then to resume the game.
Thanks!
if you are using it would be easier (and more efficient) to use a library like libgdx or andengine to do this but to do it in your current case i suggest a simple solution
on the update method use a bool to know if the ball is paused
update()
{
if(!isPaused)
{
animateBall();
}
...
}
how to pause the ball
pauseBall()
{
isPaused=true;
Timer t= new Timer();
t.schedule(new TimerTask() {
@Override
public void run() {
isPaused = false;
}
}, fewSeconds);
}