title: Xamarin replace image imageview resource in listview
body: <p>I'm beginner in Xamarin. I have a Listview, there are one textview and one imageview in each row. I wrote adatpter for it, activity, everything. My goal is, when I click an item in the listview, image changes to other one.</p>
  
  <p>Data class:</p>
  
  <pre><code>class otherLabelListData
  {
      private string otherLabel;
      private int image;
  
      public otherLabelListData(string otherLabel, int image)
      {
          this.otherLabel = otherLabel;
          this.image = image;
      }
  
      public string OtherLabel
      {
          get { return otherLabel; }
      }
  
      public int Image
      {
          get { return image; }
      }
  }
  </code></pre>
  
  <p>Here is the holder class:</p>
  
  <pre><code>class otherHolder
  {
      public TextView labelTxt;
      public ImageView iconImg;
  
      public otherHolder(View itemView)
      {
          labelTxt = itemView.FindViewById&lt;TextView&gt;(Resource.Id.otherMessageLabel);
          iconImg = itemView.FindViewById&lt;ImageView&gt;(Resource.Id.otherLabelIcon);
      }
  }
  </code></pre>
  
  <p>Adapter:</p>
  
  <pre><code>class otherLabelListAdapter : BaseAdapter&lt;otherLabelListData&gt;
  {
      private JavaList&lt;otherLabelListData&gt; mItems;
      private Context mContext;
      private LayoutInflater inflater;
  
      public otherLabelListAdapter(Context context, JavaList&lt;otherLabelListData&gt; items)
      {
          this.mItems = items;
          this.mContext = context;
      }
  
      public override Java.Lang.Object GetItem(int position)
      {
          return mItems.Get(position);
      }
  
  
      public override int Count
      {
          get
          {
              return mItems.Size();
          }
      }
  
  
      public override long GetItemId(int position)
      {
          return position;
      }
  
  
      public override otherLabelListData this[int position]
      {
          get
          {
              return mItems[position];
          }
      }
  
  
      public override View GetView(int position, View convertView, ViewGroup parent)
      {
  
          if(inflater == null)
          {
              inflater = (LayoutInflater)mContext.GetSystemService(Context.LayoutInflaterService);
          }
  
          if(convertView == null)
          {
              convertView = inflater.Inflate(Resource.Layout.OtherLabelViewRow, parent, false);
          }
  
          otherHolder holder = new otherHolder(convertView);
          holder.labelTxt.Text = mItems[position].OtherLabel;
          holder.iconImg.SetImageResource(mItems[position].Image);
  
          return convertView;
      }
  }
  </code></pre>
  
  <p>The activity:</p>
  
  <pre><code>[Activity(Label = "Activity1", MainLauncher = false, Theme = "@style/Theme.Mt")]
  public class Activity_OtherScreen : Android.Support.V4.App.FragmentActivity
  {
      private ListView mListView;
      private otherLabelListAdapter adapter;
      JavaList&lt;otherLabelListData&gt; list;
      protected override void OnCreate(Bundle savedInstanceState)
      {
          base.OnCreate(savedInstanceState);
  
          SetContentView(Resource.Layout.Other_Layout);
  
          mListView = FindViewById&lt;ListView&gt;(Resource.Id.otherList);
  
          adapter = new otherLabelListAdapter(this, getOthers());
  
          mListView.Adapter = adapter;
  
          mListView.ItemClick += MListView_ItemClick;
      }
  
  
      private JavaList&lt;otherLabelListData&gt; getOthers()
      {
          list = new JavaList&lt;otherLabelListData&gt;();
  
          otherLabelListData ot;
  
          ot = new otherLabelListData("Label 1", Resource.Drawable.send2display);
          list.Add(ot);
  
          ot = new otherLabelListData("Label 2", Resource.Drawable.send2display);
          list.Add(ot);
  
          ot = new otherLabelListData("Label 3", Resource.Drawable.send2display);
          list.Add(ot);
  
          return list;
      }
  
      private void MListView_ItemClick(object sender, AdapterView.ItemClickEventArgs e)
      {
          //..
          ???
      }
  }
  </code></pre>
  
  <p>I've tried more solution, but images don't chgange in real when I click.
  Please, give me any idea!
  Thanks!</p>