I found a very interesting solution here. Basicly, by default there is a little problem with dispatching key events in a regular Android views. Most keycodes looks like they are locked by default. Android documentation says:
When handling keyboard events with the KeyEvent class and related APIs, you should expect that such keyboard events come only from a hardware keyboard. You should never rely on receiving key events for any key on a soft input method (an on-screen keyboard).
I have tested available methods with a EditText
, and there was possible to get only a few keys like keycode back, many keys isn't available. But where I created a custom class, which extends from EditText
, and using overridden dispatchKeyEvent(KeyEvent event)
and onCreateInputConnection(EditorInfo outAttrs)
methods, it was possible to read most existing keys.
Followig this example, you can create your own WebView
class, override dispatchKeyEvent
, onCreateInputConnection
and check, which event will be send by using your keys. I hope that's help you.