There is a one-key imitation code:
public static void simulateKey(final int KeyCode) { new Thread() { @Override public void run() { try { Instrumentation inst = new Instrumentation(); inst.sendKeyDownUpSync(KeyCode); } catch (Exception e) { Log.e("Exception when sendKeyDownUpSync", e.toString()); } } }.start(); } Here is a list of all the buttons (KeyCode): Click to show
Call: simulateKey (KeyEvent.KEYCODE_F); It works correctly and accurately, simulates pressing "f".
BUT: How to simulate pressing 2 keys? I need instead: "f" output: "F".
But, the code of the capital letter is not and therefore it is necessary to press two at once: Shift + f