问题
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