I am trying to get the key pressed on soft keyboard but am unable to do so. Currently i am using the following code
@Override public boolean dispatchKeyEvent(KeyEvent KEvent) { int keyaction = KEvent.getAction(); if(keyaction == KeyEvent.ACTION_DOWN) { int keycode = KEvent.getKeyCode(); int keyunicode = KEvent.getUnicodeChar(KEvent.getMetaState() ); char character = (char) keyunicode; System.out.println("DEBUG MESSAGE KEY=" + character + " KEYCODE=" + keycode); } return super.dispatchKeyEvent(KEvent); }
It is catching key events for the hardware keyboard but not for the virtual one. Can someone help me out