How to detect when “Go” is pressed on Android Keyboard

I’m trying to detect when “Go” is pressed on the android Keyboard (the last key on the bottom right).
My code works in the emulator and on my Nexus 5, but doesn’t on some other Android devices.
What am I doing wrong?

editTextMain.setImeActionLabel("Go", KeyEvent.KEYCODE_ENTER);
editTextMain.setOnEditorActionListener(new TextView.OnEditorActionListener() {
    public boolean onEditorAction(TextView textView, int i, KeyEvent keyEvent) {
            Intent intent = new Intent(thisActivity, ActivityRisultati.class);
            return true;



Try this

editText = (EditText) findViewById(;

editText.setOnEditorActionListener(new OnEditorActionListener() {
    public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
        if (actionId == EditorInfo.IME_ACTION_DONE) {
            // do your stuff here
        return false;

Leave a Reply

Your email address will not be published. Required fields are marked *