2

I have two EditText . In first EditText i put the input and I dont want to give any inputs in the second EditText. If i press next android by default goes to that 2nd EditText to get inputs? But i dont want it as i am showing my output in the EditText. can anyone tell me how to skip one EditText? That means if press Next it doesnt go to the second edittext. it goes suppose in the buttons.

      <EditText
        android:id="@+id/etConvertFrom"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="10"
        android:inputType="numberDecimal" >

        <requestFocus />
    </EditText>
     <EditText
        android:id="@+id/etToResult"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        android:layout_weight="1"
        android:ems="10"
        android:inputType="numberDecimal" />
Hasib Hasan
  • 93
  • 1
  • 2
  • 10

2 Answers2

4

You can add this to the first EditText:

android:imeOptions="actionDone"

More on: Android: Edit Text Go Button

I'm not sure why you'd want to show output in an EditText rather than something like a TextView though.

Community
  • 1
  • 1
jak10h
  • 519
  • 4
  • 11
2

You can set the android:nextFocusDown attribute on your EditText to specify the ID of the View that should receive focus next.

For example:

<EditText
    android:id="@+id/myEditText
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:nextFocusDown="@+id/myButton" />

<EditText
    android:id="@+id/myEditText2
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

<Button
    android:id="@id/myButton"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content" />

If this EditText is the last EditText that the user will fill out before finishing the form, you could also use android:imeOptions="actionDone" to close the keyboard after the user is hits the "done" button.

Bryan Herbst
  • 66,602
  • 10
  • 133
  • 120