/*** KeyCode:KeyEvent.KEYCODE_BACK,KeyEvent.KEYCODE_HOME,KeyEvent.KEYCODE_MENU*/public static void sendKeyEvent(final int KeyCode) {//必须在子线程中调用new Thread() {public void run() {try {Instrumentation inst = new Instrumentation();inst.sendKeyDownUpSync(KeyCode);//这种方式也可以,但是执行速度较慢//Runtime runtime = Runtime.getRuntime();//runtime.exec("input keyevent " + KeyCode);} catch (Exception e) {e.printStackTrace();}}}.start();}
1200字范文,内容丰富有趣,写作的好帮手!