Disable Button click sound in android

In case anyone wonders, here is the XML way:

<Button
    ...
    android:soundEffectsEnabled="false" />

<Button
    ......
    android:soundEffectsEnabled="false"/>

Java code

button = findViewbyId(R.id.YourBUttonID);
button.setSoundEffectsEnabled(false);

Try this code for disable button click sound effect:

yourbutton.setSoundEffectsEnabled(false);

(or) Layout XML file

 <Button... android:soundEffectsEnabled="false"/>

For those who write code in Kotlin.

button.isSoundEffectsEnabled = false

Tags:

Android