I just want to catch an event when the user presses enter on editText.
I did not receive a Toast message, not "Enter pressed", not "Some key pressed!". or.
What am I doing wrong?
myEditText.setOnEditorActionListener(new OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { Toast.makeText(getApplicationContext(), "Some key pressed!", Toast.LENGTH_LONG).show(); if (event != null && (event.getKeyCode() == KeyEvent.KEYCODE_ENTER)) { Toast.makeText(getApplicationContext(), "Enter pressed", Toast.LENGTH_LONG).show(); return true; } return false; } });
ED i T:
Well, it works on Android 2.3.3 and does not work on 4.1.2 Any ideas how I can make this work on any Android device?
android android-edittext
Adam Varhegyi Apr 09 '13 at 12:26 2013-04-09 12:26
source share