我想将一些字符串发送到Android中的其他应用程序,在这种情况下,我使用的是Instrumentation,但它只读取小写字母。
Instrumentation inst = new Instrumentation();
inst.sendKeyDownUpSync(KeyEvent.KEYCODE_A);
如何将小写更改为大写? 注意:不要使用"sendStringSync"方法,因为它很慢。
问候
试试这段代码:
Instrumentation inst = new Instrumentation();
inst.sendStringSync("A");
或
Instrumentation inst = new Instrumentation();
KeyEvent keyEvent=new KeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT,KeyEvent.KEYCODE_A);
inst.sendKeySync(keyEvent);