I simply want to catch the event when the user press enter on an editText.

I did not get the Toast message, not the "Enter pressed" and not the "Some key pressed!" either.

What m 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;
            }
        });

E D I T :

Well it is working on Android 2.3.3 and not working on 4.1.2 Any ideas how can i make this work on any android device?

Edit
Report