How to simulate a button click using code?

后端 未结 7 1078
庸人自扰
庸人自扰 2020-12-04 05:27

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

7条回答
  •  渐次进展
    2020-12-04 06:15

    Starting with API15, you can use also callOnClick() that directly call attached view OnClickListener. Unlike performClick(), this only calls the listener, and does not do any associated clicking actions like reporting an accessibility event.

提交回复
热议问题