I know how to listen when the ENTER button in a TextView is pressed, as shown in the code below:
textView.setOnKeyListener(new View.OnKeyListener() { public boolean onKey(View v, int keyCode, KeyEvent event) { if((event.getAction() == KeyEvent.ACTION_DOWN) && (keyCode == KeyEvent.KEYCODE_ENTER)) { enterPressed(); return true; } return false; } });
However ... how do I listen when a key with a character is pressed (AZ, 0-9, special characters, etc.), basically everything else except ENTER, BACKSPACE or SPACE? I want to do this because I want the button to turn on when the user starts typing in the TextView. Oddly enough, the onKey () method is not even called when these character keys are pressed, is there any other way I should listen to them? Thanks in advance!
source share