2
EditText nameedit = new EditText(this);
    nameedit.setHint("First name");
    blur.addView(nameedit);
    nameedit.setWidth(32);
      nameedit.setEms(50);
    MarginLayoutParams params3 = (MarginLayoutParams) nameedit.getLayoutParams();
     params3.leftMargin = 16; params3.topMargin = 125;
    nameedit.setLayoutParams(params3);
    Typeface font33=Typeface.SERIF;
    nameedit.setTypeface(font33);

here when i press enter my edit text will become longer rether than go to next edittext view..... i want to gone on next edit text view when i press enter....*

user2610135
  • 71
  • 2
  • 7
  • 1
    This post seems to answer your question: http://stackoverflow.com/questions/3019965/keycode-enter-to-next-edittext – krodmannix May 29 '14 at 20:11
  • You have to handle that explicitly. You need to handle key presses and then determine what to do with them. @kevinrmannix post does just that. – zgc7009 May 29 '14 at 20:11
  • Have you checked out the `imeOptions` attribute? There is the possibility to set `actionNext` – SimonSays May 29 '14 at 20:20

4 Answers4

9

There is an attribute of EditText in xml for this purpose.

android:imeOptions="actionNext"

This will add "Next" button on your soft Keyboard for going to the next EditText.

Vikrant_Dev
  • 430
  • 2
  • 15
5

If you place android:singleLine="true" on your EditText it will automatically change the Enter button on your keyboard into a Next button.

Naskov
  • 4,121
  • 5
  • 38
  • 62
2

Looks like you're creating the EditText programmatically. You just need to set the IME options with the setImeOptions() method. Since (as I understand it) you do not want to allow multiple lines, you should also setMaxLines().

In this case it would be:

edit.setMaxLines(1);
edit.setImeOptions(EditorInfo.IME_ACTION_NEXT);
matiash
  • 54,791
  • 16
  • 125
  • 154
1

If you want to do it programmaticaly, my solution in most cases is:

editText.setSingleLine(true);

Or just add this in your xml item

android:singleLine="true"
Alex_D15
  • 11
  • 2