title: Android EditText next focus
body: <p>I have a couple of EditTexts spread in 2 fragments. One of the fragments has the following xml layout:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin" &gt;
  
      &lt;TextView
          android:id="@+id/title"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/cool_button"
          android:gravity="center"
          android:text="@string/user_account"
          android:textAppearance="?android:attr/textAppearanceMediumInverse" /&gt;
  
      &lt;TextView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:background="@color/yellow"
          android:gravity="center"
          android:padding="10dp"
          android:text="@string/registration_description1"
          android:textAppearance="?android:attr/textAppearanceSmall" /&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical" &gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.4"
                  android:text="@string/email_address"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textStyle="bold" /&gt;
  
              &lt;EditText
                  android:id="@+id/et_email_address"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.6"
                  android:ems="10"
                  android:hint="@string/required"
                  android:inputType="textEmailAddress" &gt;
              &lt;/EditText&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_weight="0.4"
                  android:gravity="center_vertical"
                  android:text="@string/email_address_confirmation"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textStyle="bold" /&gt;
  
              &lt;EditText
                  android:id="@+id/et_email_address_confirm"
                  android:layout_width="0dp"
                  android:layout_height="match_parent"
                  android:layout_weight="0.6"
                  android:ems="10"
                  android:hint="@string/required"
                  android:inputType="textEmailAddress" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:id="@+id/tv_title"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.4"
                  android:text="@string/title"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textStyle="bold" /&gt;
  
              &lt;Spinner
                  android:id="@+id/sp_title"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.6"
                  tools:listitem="@android:layout/simple_spinner_dropdown_item" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.4"
                  android:text="@string/first_name"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textStyle="bold" /&gt;
  
              &lt;EditText
                  android:id="@+id/et_first_name"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.6"
                  android:ems="10"
                  android:hint="@string/required"
                  android:inputType="textCapWords" /&gt;
          &lt;/LinearLayout&gt;
  
          &lt;LinearLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TextView
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.4"
                  android:text="@string/surname"
                  android:textAppearance="?android:attr/textAppearanceSmall"
                  android:textStyle="bold" /&gt;
  
              &lt;EditText
                  android:id="@+id/et_surname"
                  android:layout_width="0dp"
                  android:layout_height="wrap_content"
                  android:layout_weight="0.6"
                  android:ems="10"
                  android:hint="@string/required"
                  android:imeOptions="actionDone"
                  android:inputType="textCapWords" /&gt;
          &lt;/LinearLayout&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>And the other layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:isScrollContainer="false"
      android:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="vertical" &gt;
  
          &lt;TextView
              android:id="@+id/title"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:background="@drawable/cool_button"
              android:gravity="center"
              android:text="@string/title_fragment_register_business_and_contact_details"
              android:textAppearance="?android:attr/textAppearanceMediumInverse" /&gt;
  
          &lt;TableLayout
              android:layout_width="match_parent"
              android:layout_height="wrap_content" &gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/business_name"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_business_name"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:hint="@string/required"
                      android:inputType="textCapWords" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="match_parent"
                      android:gravity="center_vertical"
                      android:text="@string/street_name_and_number"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_street1"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="match_parent"
                      android:hint="@string/required"
                      android:inputType="textCapWords" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/street2_bigger"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_street2"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:inputType="textCapWords" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/street3_bigger"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_street3"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:inputType="textCapWords" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/street4_bigger"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_street4"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:inputType="textCapWords" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/town_or_city"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_town"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:hint="@string/required"
                      android:inputType="textCapWords"
                      android:nextFocusDown="@+id/et_county" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/county"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_county"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:hint="@string/required"
                      android:inputType="textCapWords" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:layout_marginBottom="10dp"
                  android:layout_marginTop="10dp" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/country"
                      android:textStyle="bold" /&gt;
  
                  &lt;TextView
                      android:id="@+id/textView1"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/united_kingdom" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/postcode"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_postcode"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:hint="@string/required"
                      android:inputType="textCapCharacters" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/business_tel"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_business_tel"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:hint="@string/required"
                      android:imeOptions="actionNext"
                      android:nextFocusDown="@+id/et_business_email"
                      android:inputType="phone" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/business_email"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_business_email"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:imeOptions="actionNext"
                      android:inputType="textEmailAddress"
                      android:nextFocusDown="@+id/et_website" /&gt;
              &lt;/TableRow&gt;
  
              &lt;TableRow
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content" &gt;
  
                  &lt;TextView
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:text="@string/website"
                      android:textStyle="bold" /&gt;
  
                  &lt;EditText
                      android:id="@+id/et_website"
                      android:layout_width="0dp"
                      android:layout_weight="0.5"
                      android:layout_height="wrap_content"
                      android:imeOptions="actionDone"
                      android:inputType="textWebEditText" &gt;
                  &lt;/EditText&gt;
              &lt;/TableRow&gt;
          &lt;/TableLayout&gt;
      &lt;/LinearLayout&gt;
  
  &lt;/ScrollView&gt;
  </code></pre>
  
  <p>When I press next on et_business_tel, it goes to the other fragments EditText. Sometimes it goes to et_email_address_confirm, others it goes to et_first_name. This happens in et_business_email as well. I tried android:nextFocusDown but it doesn't seem to work. Am I doing something wrong or is there a way to point the next button to focus the next editText?</p>