views:

996

answers:

2

I am using onKeyListener to get the onKey events. It works fine with the normal keyboard. But it does not work with soft keyboard. I am only able to get onKey events for numerics and not alphabets. Is there any workaround to solve this? Any kind of help will be greatly appreciated.

+1  A: 

I don't believe an OnKeyListener gets called at all with the software keyboard. It has something to do with the software keyboard being an IME device and IME devices possibly being things other than keyboards. It seems to make onKeyListener pretty much useless though, since it only works on phones with hardware keyboards. I worked around this issue recently by using TextWatcher on the EditText field in my Activity instead of using OnKeyListener.

mbaird
I tried using TextWatcher but I need the KeyUp and KeyDown events for each key pressed. Textwatcher just gives me the keydown event.
Ritesh
I don't think it's possible to listen to KeyUp and KeyDown from the software keyboard.
mbaird
A: 

onKeyListener worked perfectly on Android 1.5 via the soft keyboard

From Android 1.6 onwards the character and number keys are not going via the onKey event, yet the DEL key does

Frustrating

Martin