title: Android - set focus on EditText after Spinner selection
body: <p>I have the following items displayed on the screen:</p>
  
  <pre><code>EditText Forename
  Spinner gender selection (Male | Female)
  EditText Email
  </code></pre>
  
  <p>When the application is first launched, I want the focus to be set on the Forename EditText. Then after "Male" or "Female" has been selected in the Spinner,
  I want the focus to be set on the Email EditText that is located below the spinner.</p>
  
  <p>I have used <code>setOnItemSelectedListener</code> to set the <code>requestFocus</code> on the email EditText, but the problem is that it automatically sets the focus on
  this EditText whenever I launch the application. 
  This happens because by default the spinner displays the first selection which in this case is "Male" and therefore it thinks
  that a selection has already been made and sets the focus on the Email field. </p>
  
  <p>I don't mind the first selection to be already selected in the spinner by default but if I could somehow override the <code>requestFocus</code> to be set on the 
  Forename EditText initially that would be great.</p>
  
  <p>XML:</p>
  
  <pre><code>&lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/LinearLayout" 
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="vertical"&gt;
  
     &lt;EditText
          android:id="@+id/ForenameForm"
          android:layout_width="285dp"
          android:layout_height="65dp"
          android:hint="@string/forenameHint"
          android:lines="1"
          android:singleLine="true"
          android:textSize="20sp" &gt;
      &lt;/EditText&gt;
  
  
     &lt;Spinner  
          android:id="@+id/SpinnerGender" 
          android:spinnerMode="dialog"
          android:textSize="30sp" 
          android:layout_width="285dp"
          android:layout_height="60dp"
          android:prompt="@string/spinnerGender"  
          android:entries="@array/genderList"&gt;
  
      &lt;/Spinner&gt;
  
     &lt;EditText
          android:id="@+id/EmailForm"
          android:layout_width="285dp"
          android:layout_height="65dp"
          android:hint="@string/emailHint"
          android:lines="1"
          android:singleLine="true"
          android:textSize="20sp" &gt;
      &lt;/EditText&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Activity class:</p>
  
  <pre><code>protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          final EditText forename=(EditText)findViewById(R.id.ForenameForm);
          forename.requestFocus();
  
          final EditText email=(EditText)findViewById(R.id.EmailForm);
  
          Spinner spinner=(Spinner)findViewById(R.id.SpinnerGender);
          spinner.setFocusable(true);
          spinner.setFocusableInTouchMode(true);   
  
  
          spinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener()
          {
  
              @Override
              public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                      int arg2, long arg3) {
                  email.requestFocus();               
              }
  
              @Override
              public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
  
              }               
          });  
      }
  </code></pre>