title: RecyclerView.Adapter get ItemView through position
body: <p>In my Adapter, I call <code>LayoutManager.ChildAt(position)</code> to get the <code>itemview</code>, but the view I get is not the matched <code>itemview</code>, and when i call <code>notifyItemChanged(position)</code>, app crashes:</p>
  
  <pre><code>E/AndroidRuntime: FATAL EXCEPTION: mainProcess: com.paicaifu.riches, PID: 8502
  Java.lang.IllegalArgumentException: Called attach on a child which is not detached: ViewHolder{adb21588 position=0 id=-1, oldPos=-1, pLpos:-1}
  at Android.support.v7.widget.RecyclerView$5.attachViewToParent(RecyclerView.java:654)
  at android.support.v7.widget.ChildHelper.attachViewToParent(ChildHelper.java:239)
  at android.support.v7.widget.RecyclerView.addAnimatingView(RecyclerView.java:1107)
  at android.support.v7.widget.RecyclerView.animateChange(RecyclerView.java:3270)
  at android.support.v7.widget.RecyclerView.dispatchLayoutStep3(RecyclerView.java:3088)
  at android.support.v7.widget.RecyclerView.dispatchLayout(RecyclerView.java:2917)
  at android.support.v7.widget.RecyclerView.onLayout(RecyclerView.java:3283)
  …
  at android.view.Choreographer.doCallbacks(Choreographer.java:574) 
  </code></pre>
  
  <p>Thanks,this is my code in the adapter: </p>
  
  <pre><code>    @Override
      public void onBindViewHolder(RecyclerView.ViewHolder holder, 
      final int position) {
      if (holder instanceof CardHolder) {
         final CardHolder cardHolder = (CardHolder) holder;
         cardHolder.rootview.setOnClickListener(this);
         cardHolder.rootview.setTag(position);
         cardHolder.rootview.setOnClickListener(new View.OnClickListener() {
           @Override
           public void onClick(View v) {
           //get last itemview in adapter,but preView isnot match the
           //position,it is the visibable views on screen
           View preView = mLinearLayoutManager.getChildAt(preIndex);
           //change the datasource
           mData.getResult().getCardList().get(preIndex).setOpen(false);
           //update item
           notifyItemChanged(preIndex);//when the item is out of screen,
           //this line will cause crashes
           preIndex = position;
                      }
            });
        }
  </code></pre>
  
  <p>I just want find the last item and change it's state(open or close),when the item is out of screen,notifyItemChanged(int position) will appear problem.</p>