title: How to set spinner to a specific value when using custom Adapter
body: <p>I have a spinner that I am filling with data from a table. So I am using a custom made adapter because I need to be able to show one column but the data I will store in a table is from another column. Say I have a table called color. it has an ID field and Desc field. So my spinner will show Red, Green, Blue, Black when you select a color I needed to grab the ID for that color and store it. I have the spinner made and working fine. I created a custome adapter to pull in the table here is my adapter.</p>
  
  <pre><code>class SpinnerAdapter : BaseAdapter
  {
      private IEnumerable&lt;Color&gt; _Color;
      private Activity _context;
  
      public SpinnerAdapter(Activity context, IEnumerable&lt;Color&gt; Color)
      {
          _context = context;
          _Color = Color;
      }
  
      public override View GetView(int position, View convertView, 
                                   ViewGroup parent)
      {
          var view = (convertView ?? _context.LayoutInflater.Inflate(
              Resource.Layout.SpinnerList, parent, false)) as LinearLayout;
          var Color = _Color.ElementAt(position);
          view.FindViewById&lt;TextView&gt;(Resource.Id.ID).Text = 
              Color.ColorCd.ToString();
          view.FindViewById&lt;TextView&gt;(Resource.Id.TimeID).Text =
              Color.ColorDesc.ToString();
  
          return view;
      }
  
      public override int Count
      {
          get { return _Color.Count(); }
      }
  
      public Color GetColor(int position)
      {
          return _Color.ElementAt(position);
      }
  
      public override Java.Lang.Object GetItem(int position)
      {
          return null;
      }
      public override long GetItemId(int position)
      {
          return position;
      }
  }
  </code></pre>
  
  <p>In my Activity page I set my adapter to the spinner like so;</p>
  
  <pre><code>Spinner spAdapter = FindViewById&lt;Spinner&gt;(Resource.Id.spAdapter);
  spAdapter.ItemSelected += new EventHandler&lt;ItemEventArgs&gt;(spAdapter_ItemClick);
  var Color = ((LeavApplication)Application).LeaveRepository.GetAllColor();
  spAdapter.Adapter = new SpinnerAdapter(this, Color);
  </code></pre>
  
  <p>That part all works fine. but if I have a value I want the spinner set to how do I do it. for example I want to set the value of the spinner to "Blue" how do I find the possition of Blue so that I can use the SetSelection function to set the spinner. Is there a function I need to create in my adapter and what would it be.</p>