title: Android: How to get id of the spinner item using ArrayAdapter
body: <p>My spinner is loaded with  some messages ,each message has itz own id, </p>
  
  <pre><code>public class Message {
      private String id;
      private String message;
      public String getId() {
          return id;
      }
      public void setId(String id) {
          this.id = id;
      }
      public String getMessage() {
          return message;
      }
      public void setMessage(String message) {
          this.message = message;
      }
  
       @Override
       public String toString() {          
           return  message;
       }
  }
  </code></pre>
  
  <p>I am passing this <code>message</code> to Arrayadapter,</p>
  
  <pre><code>   protected List&lt;Message&gt; messages = null;
      ArrayAdapter &lt;Message&gt; arrayadapter = new ArrayAdapter&lt;Message&gt;( activity,android.R.layout.simple_spinner_item,messages);               
                          arrayadapter.setDropDownViewResource(R.layout.textview);
   spinner1.setAdapter(arrayadapter); 
  </code></pre>
  
  <p>Now how can i get the id of that particular message selected? 
  can i do it with arrayadapter .Any help is appreciated</p>