How can I detect any key pressed (numeric, alphabet) event in Android for EditText
I have inherited EditText class an made my 开发者_JS百科custom class, MyEditText.
and want to detect key pressed(say 'a', 'b', 'c'... '0', '1', '2'... etc.) event in Android. How?
It seems overridden method onKeyDown(int keyCode, KeyEvent event) is called when 'back', '\', '/', 'DEL', '@' keys are pressed, but not for any numeric or alphabets.
Maybe what you need is not a keypress event, but a text change event. Then you can use addTextChangedListener method.
精彩评论