title: How to set a default text to a Spinner
body: <p>I want to set the spinner to show the name country even if any other list is selected. I have used a textview which displays the selected item of the Spinner List. As I used the setselection method to set the spinner title to Country the EditText also eventually changes. I went through various topic answered regarding this but couldn't find suitable response</p>
  
  <p>I am attaching my code below</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.example.spinner;
  
  import android.os.Bundle;
  import android.app.Activity;
  import android.database.Cursor;
  import android.view.Menu;
  import android.view.View;
  import android.widget.AdapterView;
  import android.widget.AdapterView.OnItemSelectedListener;
  import android.widget.ArrayAdapter;
  import android.widget.Spinner;
  import android.widget.TextView;
  
  public class MainActivity extends Activity {
  
      Spinner sp;
      TextView t;
      String[] country;
      int sp_position;
      String selected;
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          String myString = "Country"; 
  
          sp = (Spinner)findViewById(R.id.spinner1);
          t = (TextView)findViewById(R.id.textView1);
          country = getResources().getStringArray(R.array.spinner);
          ArrayAdapter&lt;String&gt; ad = new ArrayAdapter&lt;String&gt;(MainActivity.this, android.R.layout.simple_spinner_dropdown_item,country);   
          sp_position = ad.getPosition(myString);
          sp.setAdapter(ad);
          ad.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
  
          sp.setOnItemSelectedListener(new OnItemSelectedListener() {
  
              @Override
              public void onItemSelected(AdapterView&lt;?&gt; arg0, View arg1,
                      int arg2, long arg3) {
                  selected = sp.getSelectedItem().toString();
                  System.out.println(selected);
                  setid();
  
              }
  
              private void setid() {
                  sp.setSelection(sp_position);
  
  
              }
  
              @Override
              public void onNothingSelected(AdapterView&lt;?&gt; arg0) {
                  // TODO Auto-generated method stub
  
              }
          });
  
          t.setText(selected);
  
      }
  
  
  
  
      @Override
      public boolean onCreateOptionsMenu(Menu menu) {
          // Inflate the menu; this adds items to the action bar if it is present.
          getMenuInflater().inflate(R.menu.main, menu);
          return true;
      }
  
  }
  </code></pre>
  
  <p>My XML file</p>
  
  <pre><code>&lt;RelativeLayout 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:paddingBottom="@dimen/activity_vertical_margin"
      android:paddingLeft="@dimen/activity_horizontal_margin"
      android:paddingRight="@dimen/activity_horizontal_margin"
      android:paddingTop="@dimen/activity_vertical_margin"
      tools:context=".MainActivity" &gt;
  
      &lt;TextView
          android:id="@+id/textView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true"
          android:layout_marginLeft="48dp"
          android:layout_marginTop="69dp"
          android:maxLines="4"
          android:hint="Address" /&gt;
  
      &lt;Spinner
          android:id="@+id/spinner1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignRight="@+id/textView1"
          android:layout_below="@+id/textView1"
          android:layout_marginTop="72dp" 
          /&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>My STRINGS.XML</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;resources&gt;
  
      &lt;string name="app_name"&gt;Spinner&lt;/string&gt;
      &lt;string name="action_settings"&gt;Settings&lt;/string&gt;
      &lt;string name="hello_world"&gt;Hello world!&lt;/string&gt;
      &lt;string-array name="spinner"&gt;
          &lt;item&gt;Country&lt;/item&gt;
          &lt;item&gt;India&lt;/item&gt;
          &lt;item&gt;Russia&lt;/item&gt;
          &lt;item&gt;USA&lt;/item&gt;
          &lt;item&gt;France&lt;/item&gt;
          &lt;item&gt;United Kingdom&lt;/item&gt;
      &lt;/string-array&gt;
  &lt;string name ="Country"&gt;Country&lt;/string&gt;
  &lt;/resources&gt;
  </code></pre>
  
  <p>My Requirement is whatever is selected in the spinner the Textview should display the selected Item but The spinner should always show the first item or in my case Country</p>