Android simulate key press
问题 How can I programmatically simulate a key press on a Droid? I would like to mimic a manual key press (appearing on the droid that someone is pressing a key but it is being done programmatically). There are solutions out there involving IWindowManager , but that isn\'t an option anymore in the new SDK. 回答1: You can use instrumentation, ie following code called from onCreate of your activity will cause menu to be opened and closed multiple times: new Thread(new Runnable() { @Override public