title: basic spinner example
body: <p><strong>Main.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"
  &gt;
      &lt;Spinner
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:id="@+id/spin"
          android:entries="@array/num"
      /&gt;
      &lt;Button
          android:layout_width="wrap_content" 
          android:layout_height="wrap_content" 
          android:id="@+id/btn"
          android:text="Click ME"
          android:gravity="center"
      /&gt;
      &lt;TextView  
          android:layout_width="fill_parent" 
          android:layout_height="wrap_content" 
          android:id="@+id/txtv"
      /&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>Spin.java</strong></p>
  
  <pre><code>package com.and.spin;
  import android.app.Activity;
  import android.os.Bundle;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  import android.widget.Spinner;
  import android.widget.TextView;
  
  public class spin extends Activity {
      /** Called when the activity is first created. */
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          final TextView tv=(TextView)findViewById(R.id.txtv);
  
          Button b=(Button)findViewById(R.id.btn);
          final Spinner s=(Spinner)findViewById(R.id.spin);
  
          b.setOnClickListener(new OnClickListener() {                            
              public void onClick(View arg0) {
                  String spin=s.toString();
                  tv.setText(spin);
              }
          });
      }
  }
  </code></pre>
  
  <p>In this program, i'm trying to display selected options from the Spinner to the TextView. But output dsiplays <strong>android.widget.Spinner@44c0d7f8</strong></p>
  
  <p>I want output like (1,2,3,4 or 5) as the option selected in Spinner rather than android.widget.Spinner@44c0d7f8</p>