开发者

Inject Keystrokes

Is there a way to inject keystrokes into the JVM on the Android platform?

I'm looking for something like jav开发者_Go百科a.awt.Robot but I don't think that's available on Android

thanks


It sounds like you need InstrumentationTestCase.sendKeys()

http://developer.android.com/reference/android/test/InstrumentationTestCase.html#sendKeys(java.lang.String)

http://developer.android.com/reference/android/view/KeyEvent.html


You can use:

$ adb -s <serialno> emu event send <event>

where the event description can be something like:

"EV_KEY:KEY_A:1"


Well I'm actually working on a Synergy port to the android (synergy-foss.org) and I think the best (and only method) for faking out keystrokes on the device itself is to write to /dev/input/uinput. However it seems this is only available with Cyanogen mod

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜