Android Question system sound on button click event

dagnabitboy

Active Member
Licensed User
Longtime User
Two quick questions:
1. Is there a way to detect the system setting that enables the click sound on click events?
2. Is there a way to enable/disable the click event sound within my app?

Thank you!
 

dagnabitboy

Active Member
Licensed User
Longtime User
Thanks Alexander. I tried it, and have used it in the past, but it no longer seems to work (Android 8). What I'm looking for though is a way to control the system click sound. When I enable the system click sounds from device settings I do get a nice "click" with each key press. I just want to be able to turn this on or off from within my app. In other words, if system click sounds are turned off, I'd like to be able to turn them on within my app, for use just by my app!
 
Upvote 0

Alexander Stolte

Expert
Licensed User
Longtime User
Then look this:

B4X:
Dim jo As JavaObject = Button1
jo.RunMethod("setSoundEffectsEnabled", Array As Object(false))

or

B4X:
For Each v As View in Activity.GetAllViewsRecursive
If v Is Button Then
  Dim jo As JavaObject = v
 
jo.RunMethod("setSoundEffectsEnabled", Array As Object(False))
End If
Next
 
Upvote 0
Top