Map KeyEvent KeyCode to key name

Viewed 21

I have key binding settings that should display what key was pressed on a device with physical keyboard. Right now, in my onKeyListener method, I'm just displaying the key code (e.g. KEYCODE_F1 → I display "131").

etKeyPressed.setText(String.valueOf(keyEvent.getKeyCode()));

Is there a way I could, instead of that keyCode, display a name like "KEYCODE_F1" without having to make my own map?

0 Answers
Related