I'm trying to listen to key events in android web view. Example when user is filling a form, I should receive the key events. This is my WebView code
public class MyWebView extends WebView implements OnKeyListener
{
.....
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
Log.i("PcWebView", "onKeyDown keyCode=" + keyCode);
return super.onKeyDown(keyCode, event);
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
Log.i("PcWebView", "onKeyUp keyCode=" + keyCode);
return super.onKeyUp(keyCode, event);
}
@Override // Listener is initialized in the constructor
public boolean onKey(View v, int keyCode, KeyEvent event)
{
Log.i("PcWebView", "onKey keyCode=" + keyCode);
return false;
}
.....
}
neither of the methods onKeyDown
, onKeyUp
and onKey
are being called when user types into the textboxes or textareas. Is it possible to achieve this or has Android restricted this b'cos of a possible privacy breach?