Disable Button click sound in android

How to disable click sound of a particular button in Android app?

Here is my code:

more1after.setOnClickListener(new OnClickListener() {
            public void onClick(View v) {
                sc.scrollTo(sc.getScrollX() + 75,
                sc.getScrollY() + sc.getWidth() + 5);
            }
        });

Solution 1:

Try this code for disable button click sound effect:

yourbutton.setSoundEffectsEnabled(false);

(or) Layout XML file

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

Solution 2:

In case anyone wonders, here is the XML way:

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

Solution 3:

For those who write code in Kotlin.

button.isSoundEffectsEnabled = false