title: Java.lang.Illegal State Exception: The specific child already has a parent
body: <p>I am getting following exception when implementing the code below the exception.</p>
  
  <p>Java.lang.IllegalStateException: The specific child already has a parent. you must call the removeView() on the child's parent first.</p>
  
  <pre class="lang-cs prettyprint-override"><code>using System;
  using Android.Support.V7.Widget;
  using Android.Views;
  using Android.Widget;
  using Android.App;
  
  namespace Recycle.Droid
  {
  
      internal class albumadapter1 : RecyclerView.Adapter
      {
          // private int[] imageid;
          // private Photo_album palbum;
          // private _Recycler _Recycler;
          private int[] imageid;
          private Activity mainActivity;
  
          public albumadapter1(Activity context, int[] imageid)
          {
              this.mainActivity = context;
              this.imageid = imageid;
          }
          public override int ItemCount
          {
              get
              {
                  return imageid.Length;
              }
          }
  
          public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
          {
              PhotoViewHolder vh1 = holder as PhotoViewHolder;
              vh1.img.SetImageResource(imageid[position]);
              //vh.Caption.Text = palbum[position].Caption;
          }
  
          public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
          {
              var itemview = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.view_holder, parent);
              PhotoViewHolder vh = new PhotoViewHolder(itemview);
              return vh;
          }
      }
      public class PhotoViewHolder : RecyclerView.ViewHolder
      {
  
          public TextView tv { get; private set; }
          public ImageView img { get; private set; }
  
          public PhotoViewHolder(View itemView) : base(itemView)
          {
  
              img = itemView.FindViewById&lt;ImageView&gt;(Resource.Id.imageView1);
              //  var Caption = itemView.FindViewById&lt;TextView&gt;(Resource.Id.textView);
              // public PhotoViewHolder(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
  
          }
      }
  }
  </code></pre>
  
  <p>please help me with problem.</p>