how to simulate key press in Android with AccessibilityService

最后都变了- 提交于 2019-12-13 07:15:20

问题


I am writing an accessibility service. I've been trying to do some auto search on an app. I uses the accessibilityservice action_paste to fill in the EditText. Then I need to simulate the key press on the soft keyboard. But I didn't find out how to. Can you guys help me out?


回答1:


You could try Activity.dispatchKeyEvent(KeyEvent) There are also functions in Instrumentation But those are mostly for testing.



来源:https://stackoverflow.com/questions/36285587/how-to-simulate-key-press-in-android-with-accessibilityservice

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!