Currently, my application have a webView that loads certain forms/websites etc.
Now I want to capture the KeyPressEvents within this webView. Below is the code I am using:
@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;
Toast.makeText(this,"DEBUG MESSAGE KEY=" + character + " KEYCODE=" + keycode, Toast.LENGTH_SHORT).show();
}
return super.dispatchKeyEvent(KEvent);
}
Using the above code, I could only capture for backspace and numbers. Alphabets and special characters are not reflected.
Is it suppose to be like that? Or I must create my own app specific keyboard to capture the keypress events (android app specific soft keyboard)?