O'Reilly logo

Mastering Android Game Development by Raul Portales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Disabling system sounds

Android has default sounds for button clicks. If you want to use your own sounds for the click action, you also have to disable the system sounds. This is something that we will want almost every time. Luckily it is very easy to do. We just have to modify the application style we have already defined in res/styles.xml and tell it that we want to disable sound effects:

<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
  <item name="android:soundEffectsEnabled">false</item>
</style>

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required