I'm in the process of creating my own keyboard. I need help finding out the android:codes number for the menu button so I can implement the zoom function. Thank you.
Asked
Active
Viewed 1,765 times
0
-
[You mean this one?](http://developer.android.com/reference/android/view/KeyEvent.html#KEYCODE_MENU) I just googled for "android code number menu key" – Mike Cluck Apr 04 '16 at 22:54
-
From that it says: Key code constant: Menu key. Constant Value: 82 (0x00000052). However, the constant 82 is not the same when i put it onto android studio. – Ivan T Apr 04 '16 at 23:00
-
What do you mean "the constant 82 is not the same when i put it onto android studio"? – Mike Cluck Apr 04 '16 at 23:03
-
http://puu.sh/o6lzA/a336780062.png 82 is an uppercase R, so my question is how would i get android studio to recognize 82 and not the ACII number. Also, would it be possible to implement zoom+i in one key? – Ivan T Apr 04 '16 at 23:14
1 Answers
0
The menu key for Android keyboard is constant value 82 which if you're using the emulator can be triggered using Ctrl + M
.
A good way to test this is to override the dispatchKeyEvent() method which is used in any Activity.
@Override
public boolean dispatchKeyEvent(KeyEvent event) {
Log.d(TAG, "dispatchKeyEvent: " + event.getKeyCode());
return super.dispatchKeyEvent(event);
}
Whenever you press Ctrl + M
while having that Activity open it'll trigger that dispatchKeyEvent method which will print out: D/YourActivity: dispatchKeyEvent: 82

Mark O'Sullivan
- 10,138
- 6
- 39
- 60