I found several examples on this subject, somewhere with a switch somewhere with c if, but that is not the point, and so it does not work. The handler responds only to pressing numbers. Even the default switch `e does not respond. What am I doing wrong? Here is the code
edit.setOnKeyListener(new View.OnKeyListener() { @Override public boolean onKey(View v, int keyCode, KeyEvent event) { if (KeyEvent.ACTION_DOWN == event.getAction()){ switch (keyCode){ case KeyEvent.KEYCODE_ENTER: Log.e("TAG", "Нажат интер"); break; case KeyEvent.KEYCODE_2: Log.e("TAG", "Нажато 2"); break; case KeyEvent.KEYCODE_E: Log.e("TAG", "Нажато e"); break; default: Log.e("TAG", "Нажато что то"); } } return false; } }); The entire handler responds only to numbers. I press the letters or any other characters. Default does not work, I press numbers except 2 - it works. I press 2 - it works. All keys peretykat "pressed e" does not come out. And inter too. Maybe I do not know about the phone model, I have a Lenovo S650 Android 4.4.2 Api 19. There is no other phone to check.