Did you read the documentation?
Key presses in software keyboards will generally NOT trigger this listener, although some may elect to do so in some situations. Do not rely on this to catch software key presses.
Also, your way of capturing keys is very vague. You are not even checking the keyCode sent to you by using:
@Override public boolean onKeyDown(int keyCode, KeyEvent event) { return false; }
You can handle onKey from a View:
public boolean onKey(View v, int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_ENTER:
/* This is a sample for handling the Enter button */
return true;
}
return false;
}
Remember to implement OnKeyListener and to set your listener
viewname.setOnKeyListener(this);