Enabling and disabling music and sound FX

Now we have music and sound effects working, but we are missing a very important point: allowing the user to disable them. If you add sounds to a game, you need to provide a way to disable them. Many people like to play in silence.


Always provide a way for the user to disable music and sound effects individually.

To do this, we will add two buttons on the main screen (one for music and one for sounds) to enable and disable each one independently. These options should also be present on the Pause dialog, but we will get into that when we rework the dialogs in the next chapter.

On the one hand, we are going to update the layout and the code of MainMenuFragment; on the other hand, we will make SoundManager ...

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

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