Hello, I'm researching on android game development, especially the SurfaceView method to make simple 2D game. I've learnt about SurfaceView and a gameloop to call the overridden onDraw() function.

My question is, using a game loop that constantly update and draw, how can I perform some procedural task, such as 5 second-countdown before the real game begins.

I understand that we can make this work by enabling countdown if (elapsedTime < 5000) like this, but I want to avoid game loop keep checking if the elapsed time is less than five seconds.

Any suggestion?