im making a game on android. i need to pause the game, show the pause menu (through a new activity or a dialog anyhow) and then resume the game. this is how i am pausing and resuming my thread:
public void pause() {
isRunning = false;
while (true) {
try {
ourThread.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
break;
}
ourThread = null;
}
public void resume() {
isRunning = true;
ourThread = new Thread(this);
ourThread.start();
}
This works perfectly fine when i go to the home screen and everything but im confused on how to show a menu and operate it.
Have you considered using a popup menu? You could do something where you showPopup() on pause(). Then, you can click anywhere on the screen to dismiss the popup, or you can probably set the resume in the onMenuItemClick
Does that make sense?