ime
Android: Edit Text Go Button
You want a combination of android:imeOptions and setOnEditorActionListener <EditText android:id=”@+id/some_edittext” android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:imeOptions=”actionSend”> </EditText> some_edittext.setOnEditorActionListener(new OnEditorActionListener() { public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { if (actionId == EditorInfo.IME_ACTION_SEND) { some_button.performClick(); return true; } return false; } }); Obviously you should change actionSend to the action you want, and update IME_ACTION_SEND correspondingly.
Setting EditText imeOptions to actionNext has no effect
Just add android:maxLines=”1″ & android:inputType=”text” to your EditText. It will work!! 🙂
imeOptions “actionNext” programmatically – how to jump to next field?
You can use the constants from EditorInfo class for the IME options. like, editText.setImeOptions(EditorInfo.IME_ACTION_NEXT);
How do I handle ImeOptions’ done button click?
I ended up with a combination of Roberts and chirags answers: ((EditText)findViewById(R.id.search_field)).setOnEditorActionListener( new EditText.OnEditorActionListener() { @Override public boolean onEditorAction(TextView v, int actionId, KeyEvent event) { // Identifier of the action. This will be either the identifier you supplied, // or EditorInfo.IME_NULL if being called due to the enter key being pressed. if (actionId == EditorInfo.IME_ACTION_SEARCH … Read more