Moving forward with the example

Now we are going to change the example a bit. We are going to make a pause dialog from which we can resume or stop the game. This dialog will be shown if the user taps on the pause button and if he or she hits the back key.

Finally, we are going to add one fragment from which the player can start the game and we will separate the game fragment from the menu.

So, we'll be creating and fragment_main_menu.xml. The content of the layout will be extremely simple:

<?xml version="1.0" encoding="utf-8"?> <FrameLayout xmlns:android="" android:layout_width="match_parent" android:layout_height="match_parent"> <TextView android:layout_gravity="center_horizontal|top" ...

Get Android: Programming for Developers now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.