I have a game for android, and when the user wins, it shows a dialog asking if they want to play again. If they say “no”, the application exits, and if they say “yes”, it starts another game. The problem is that a new game starts as the dialog is displayed, instead of waiting for the user to press a button. The code is like this:
if (won) {
showDialog(DIALOG_WON_ID);
imageAdapter.initializemThumbIds(); // this starts a new game
}
I don’t want the start-new-game line to execute until the dialog is dismissed.
Put this call
Into the “yes” button click event.
EDIT:
Something like this: