After lots of R & D, i found a point regarding android soft keyboard onKeyListener, this is bug of Android, Please refer this link: see this, In SDK version 16 and above there is a bug with the KEYCODE_DEL event not being delivered to a OnKeyListener on an edittext. Other events such as DONE and pressing a letter/number key work, but not the KEYCODE_DEL. So finally we can get either Delete button event or get all key event except Delete. Thanks.
How to get click event of android Softkeyboard?
-
13-10-2022 - |
Question
I have a numeric keyboard in my application, I want to get click event of any pressed key, I am using below code:
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
switch (keyCode) {
case KeyEvent.KEYCODE_1:
// here my code stuff
return true;
default:
break;
}
return false;
}
Here I can not get any other key click event.
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow