Book Image

Mastering Android Game Development

By : Raul Portales
Book Image

Mastering Android Game Development

By: Raul Portales

Overview of this book

Table of Contents (18 chapters)
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
API Levels for Android Versions
Index

Custom dialogs


The next step in making our UI nicer is to stop using the standard Android dialogs and create our own custom ones instead. Once again this is something completely discouraged for apps but it makes a lot of sense for games.

There are many reasons why a custom dialog system is better for games:

  • The default dialogs will look different in different Android versions. This is in fact great when you use AlertDialog in an app, since it mimics the dialogs of all the rest of the apps, but not the games. We want consistency.

  • Default dialogs use the system font.

  • If you try to set a custom background or a custom content view, AlertDialogs look terrible. Again, you should never do that in an app, but you definitely want it in a game.

  • The standard dialogs ruin the immersive experience by showing the notifications and system bars when they are on screen.

  • It is hard to replace the animations of AlertDialog with custom ones.

We are going to build a system that shows our dialogs on screen, with a gray...