Open In App

How to change Input Method Action Button in Android?

Last Updated : 14 Jul, 2021
Like Article

In this article, IME(Input Method Action) Option is changed in android according to our requirement. Input Method Action Button is located in the bottom right corner of the soft keyboard. By default, the system uses this button for either a Next or Done action unless your text field allows multi-line text, in which case the action button is a carriage return. However, you can specify additional actions that might be more appropriate for your text fields, such as Go, Send, Previous, None, etc. The IME option for Next and Done are shown below.

  • Action Next
  • Action Done
    1. Add the following code in activity_main.xml file.In this file we specify IME option to the EditText according to the need. Here an imageview and two edittexts are added and and IME option is specified for actionDone.


      <?xml version="1.0" encoding="utf-8"?>
              android:inputType="text" />
              android:inputType="textPassword" />


    Now add the following code in file. In this file we add listener to our EditText which will correspond to our action accordingly. Here we override onEditorAction method and show toast for ACTION DONE and ACTION NEXT IME options.

    package org.geeksforgeeks.imeoption;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.view.inputmethod.EditorInfo;
    import android.widget.EditText;
    import android.widget.TextView;
    import android.widget.Toast;
    public class MainActivity extends AppCompatActivity {
        protected void onCreate(Bundle savedInstanceState)
            EditText login = findViewById(;
            EditText password = findViewById(;
        // whenever the user clicks on IME button this listener will
        // get invoked automatically.
        private TextView.OnEditorActionListener actionListener
            = new TextView.OnEditorActionListener() {
                  public boolean onEditorAction(TextView v,
                                                int actionId, KeyEvent event)
                      switch (actionId) {
                      case EditorInfo.IME_ACTION_NEXT:
                                         "Next", Toast.LENGTH_SHORT)
                      case EditorInfo.IME_ACTION_DONE:
                                         "Login", Toast.LENGTH_SHORT)
                      return false;


    Like Article
    Suggest improvement
    Share your thoughts in the comments

Similar Reads