在Android中调用keypress事件?

viv*_*viv 2 android keypress

我需要在android中调用按键事件。有什么建议么 ?????

Sep*_*phy 5

您需要使用工具类:

Instrumentation i = new Instrumentation();
i.sendKeyDownUpSync(KeyEvent.KEYCODE_A);
Run Code Online (Sandbox Code Playgroud)

这应该等效于按键盘上的A。