Android keyboard next button issue on EditText

how to automatically move to the next edit text in android
how to change the focus to next edit text in android?
different types of edittext in android
android numeric keyboard
android-edittext keyboard
hide keyboard android
android keyboard enter key action

I am facing an issue, I have username & password fields on activity, now when I click on username keyboard appears but no next button on it and I cannot move to next Edittext control through keyboard in this case, keyboard displays enter button in it as attached in screenshot which increases its height,

Can anyone guide me what is the solution to this problem (to display next button on edittext)?

My Code

txtUserid = (EditText)findViewById(;
        txtUserPasword = (EditText)findViewById(;


add this lines below your lines of code you provided:

txtUserid.setOnKeyListener(new OnKeyListener() {

    public boolean onKey(View v, int keyCode, KeyEvent event) {
          // If the event is a key-down event on the "enter" button
          if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
               (keyCode == KeyEvent.KEYCODE_ENTER))
                // Perform action on Enter key press
                return true;
          return false;

txtUserPasword.setOnKeyListener(new OnKeyListener() {

    public boolean onKey(View v, int keyCode, KeyEvent event) {

          if ((event.getAction() == KeyEvent.ACTION_DOWN) &&
                    (keyCode == KeyEvent.KEYCODE_ENTER))
                 // Perform action on Enter key press
                 // check for username - password correctness here
                 return true;
          return false;

Move to another EditText when Soft Keyboard Next , Known issues · StackOverflow A keyboard offers not only a convenient mode for text input, but also offers a way for users to All interactive widgets provided by the Android framework (such as Button and EditText ) are focusable. Each attribute designates the next view to receive focus when the user navigates in that  It might be very late but I have a solution which is much easier to apply. Just add this code to the edittext field in the layout.xml file. Add this to edittext which you want to show a next button instead of a done button. So it will point to the next Edittext field. android:imeOptions="actionNext"

Add android:singleLine="true" android:nextFocusDown="@+id/textView2" on your xml. Will show Next key and also focus to the next field.

Specify the input method type, How do I change the number on my Android phone keyboard? Android Quick Tip. Close the keyboard when you click ‘DONE’… seems like a simple task, right? Unfortunately, clicking ‘DONE’ or the ‘RETURN’ button in even a single line Android EditText will not drop focus and close the soft keyboard. In most cases it will just generate a new line of text.

In your layout, just set the XML attributes android:imeOptions="actionNext" for your first three text boxes and android:imeOptions="actionDone" for the last one.

More Examples

Support keyboard navigation, in all situations. In some cases you will want to pass in InputMethodManager. For the code below, each EditText will have a Next button that navigates to the next field and the last one will have Done button that will dismiss the keyboard: EditText editText = new EditText(this); editText.setInputType(InputType.TYPE_CLASS_TEXT); For the code below, no change, each EditText has a Return button: EditText editText = new EditText(this); editText.setImeOptions(EditorInfo.IME_ACTION_DONE);

If your EditText is supposed to have only 1 line, add the attribute android:singleLine="true" on your XML, that will remove the Enter key and replace it with Next / Done button.

Top 7 Android Keyboards with a Number Row, to you layout with the EditText object. You should usually do so in your XML layout with a <EditText> element. How to automatically set whole layout top of android keyboard while EditText is selected. By default android keypad dose not move the activity screen layout and shows just above the layout screen but this kind of functionality sometimes interrupt the user experience because while user starts typing on EditText then it will not move automatically.

Another best solution would be:


Close/hide android soft keyboard, Tell us about the problem. On Android, after updating to tns-core-modules v3.3.0, I found that when pressing the next button on the keyboard  I am wondering if there is a way to handle the user pressing Enter while typing in an EditText, something like the onSubmit HTML event.. Also wondering if there is a way to manipulate the virtual keyboard in such a way that the “Done” button is labeled something else (for example “Go”) and performs a certain action when clicked (again, like onSubmit).

Text Fields, learn how to change the soft keyboard's editor action button by specifying clicks on it Duration: 5:26 Posted: Apr 8, 2018 <EditText android:id= "@+id/et_simple" android:layout_height= "wrap_content" android:layout_width= "match_parent" > </EditText> Note that an EditText is simply a thin extension of the TextView and inherits all of the same properties.

Android Keyboard Next Doesn't Move Focus To Next TextField , Unfortunately, clicking 'DONE' or the 'RETURN' button in even a single line Android EditText will not drop focus and close the soft keyboard. Android attempts to be user-friendly and replaces the standard "Done" button to the right of the entry box with a "Next" button, probably because it recognizes the presence of other EditTexts My application does not need this functionality, and in fact impairs the functionality of the application. How do I remove or disable that functionality?

How to Change the Input Method Action, Need Prev,Next button above soft keyboard in android. EditText et1 = (EditText)​findViewById(; et1.setImeOptions(EditorInfo.IME_ACTION_NEXT);​  Most soft input methods provide a user action button in the bottom corner that's appropriate for the current text field. By default, the system uses this button for either a Next or Done action unless your text field allows multi-line text (such as with android:inputType="textMultiLine" ), in which case the action button is a carriage return

  • thanks for your reply, it has stopped increasing edittext height but still i have no way to move to next editext :(
  • please check my edited answer.Lines in txtUserid's onKeyListener has been changed.
  • +1 for smartwork but I don't think this Work for Multiline input?
  • @deepakSharma: yes..but i suggested according to his requirement.and obviously it is a trick.
  • This works for me, although it might be important to note that if you set android:imeOptions="actionNext", then it will override the attributes mentioned in this answer
  • If you use android:singleLine="true" means, that itself good enough to visible the "next" button on the keypad
  • It works for me when also I get rid of android:imeOptions="actionNext"
  • i have used it on edittext but i dont know why it does not work. :(
  • "next" produces an error: "Error:(48, 45) String types not allowed (at 'imeOptions' with value 'next').". It should be "actionNext". And android:singleLine="true" is deprecated. Use android:maxLines="1" instead.
  • oddly enough MaxLines="1" didn't work on my Galaxy 4, had to use singleLine="true"
  • singleline="true" its deprecated but its worked bro ,,
  • It's deprecated. Use android:maxLines="1" instead