Search code examples
androidbuttonaudiodefault

Programatically prevent default button sound on Android


In an Android app designed for Froyo, I have a button that plays a music file when you tap it. However it also plays the default "button click" sound, which covers the start of the music. How can I prevent the "click" sound from being played automatically?


Solution

  • Try this for removing the click sound:

    buttonName.setSoundEffectsEnabled(false);