6.8.10. Method showGameOverDialog
When the game ends, the showGameOverDialog
method (Fig. 6.16) displays a DialogFragment
(using the techniques you learned in Section 5.6.9) containing an AlertDialog
that indicates whether the player won or lost, the number of shots fired and the total time elapsed. The call to method setPositiveButton
(lines 433–444) creates a reset button for starting a new game.
414 // display an AlertDialog when the game ends415 private void showGameOverDialog(final int messageId)416 {417 // DialogFragment to display quiz stats and start new quiz418 final DialogFragment gameResult =419 new DialogFragment() 420 {421 // create ...
Get Android™ How to Program, Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.