Android - how to open menu on old Android emulator
Older Android versions used a separate button to open a menu (which was then replaced by the action bar and its overflow menu). When testing applications using an emulator with some old Android, we often want to somehow access the menu. The emulators used to provide a button for this, but such buttons were shown only in a specific skin: Skin with dynamic hardware controls.
I created an emulator with a very old Android (API level 5) and now, with current updated Android SDK, somehow such buttons are not shown and even the keyboard shortcuts (F2 or Page up) do not work.
I tried to open the menu using adb:
It ended up with a very strange response:
 Killed input keyevent K...
The solution is simple - use a numeric key code:
If somehow that won’t work either, here is another solution:
You can find another emulator keyboard shortcuts e.g. in this post at Stack Overflow.
The solution using /dev/input/event0 is based on this Stack Overflow post. This can be used for simulating multiple buttons at once or long pressing of a button, e.g. backspace for 2 seconds: