How can I trigger a button click event using code in Android? I want to trigger the button click programmatically when some other event occurs.
Same Problem I am Fac
Android's callOnClick()
(added in API 15) can sometimes be a better choice in my experience than performClick()
. If a user has selection sounds enabled, then performClick()
could cause the user to hear two continuous selection sounds that are somewhat layered on top of each other which can be jarring. (One selection sound for the user's first button click, and then another for the other button's OnClickListener
that you're calling via code.)