O
O
oleg0xff2015-02-03 16:04:13
Android
oleg0xff, 2015-02-03 16:04:13

How to process all keys, including: F1,F2,F4,F5,F6,F10, on USB keyboard connected to android?

I am writing a terminal client for android. I am connecting a keyboard to a USB device. I need to process ALL keystrokes in it, not allowing any action to be performed outside of my application. I write dispatchKeyEvent(KeyEvent event) which always returns true - If I understand correctly, I'm saying that I handled the event and no one should handle it anymore. But, nevertheless, on the keys: F1, F2, F4, F5, F6, F10, the android minimizes my application and performs some actions. Unfortunately, I have no experience with android, so I don't understand what to do to avoid the standard action, but simply pass the keycode scan to my application. Please tell me if anyone knows.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vladimir Yakushev, 2015-03-18
@VYakushev

Google has a tutorial on handling keypresses. Key codes F1-F12 correspond to KeyEvent.KEYCODE_F1 - KeyEvent.KEYCODE_F12. A list of all codes can be found at developer.android.com/reference/android/view/KeyEv...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question