title: why getAdapterPosition return wrong value, when I make ViewHolder as class member of RecyclerView.Adapter
body: <p>I got a weird problem. I did search on internet, but it looks no same problems.</p>
  
  <p>In FruitAdapter.java,if I make <strong>ViewHolder</strong> be class member of <strong>RecyclerView</strong>, then <strong>getAdapterPosition</strong> will return wrong value!!!.</p>
  
  <p>if I make ViewHolder as RecyclerView'  function local variable, NO error. the ViewHolder is constructed at same place,in onCreateViewHolder,</p>
  
  <p>In FruitAdapter.java,</p>
  
  <p>Here is the code.</p>
  
  <p>MainActivity.java</p>
  
  <pre><code>package com.example.recyclerviewtest;
  
  import android.support.v7.app.AppCompatActivity;
  import android.os.Bundle;
  import android.support.v7.widget.LinearLayoutManager;
  import android.support.v7.widget.RecyclerView;
  import android.support.v7.widget.StaggeredGridLayoutManager;
  
  import java.util.ArrayList;
  import java.util.List;
  import java.util.Random;
  
  public class MainActivity extends AppCompatActivity {
  
      private List&lt;String&gt; fruitList = new ArrayList&lt;String&gt;();
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
          initFruits();
          RecyclerView recyclerView = (RecyclerView) findViewById(R.id.recycler_view);
          LinearLayoutManager linerLayoutManager = new LinearLayoutManager(MainActivity.this);
          recyclerView.setLayoutManager(linerLayoutManager);
          FruitAdapter adapter = new FruitAdapter(fruitList);
          recyclerView.setAdapter(adapter);
      }
  
      private void initFruits() {
          for (int i = 0; i &lt; 2; i++) {
  
              fruitList.add("apple");
              fruitList.add("banana");
              fruitList.add("orange");
              fruitList.add("watermelon");
              fruitList.add("pear");
  
             }
      }
  }
  </code></pre>
  
  <p>FruitAdapter.java</p>
  
  <pre><code>package com.example.recyclerviewtest;
  
  import android.support.v7.widget.RecyclerView;
  import android.view.LayoutInflater;
  import android.view.View;
  import android.view.ViewGroup;
  import android.widget.ImageView;
  import android.widget.TextView;
  import android.widget.Toast;
  
  import java.util.List;
  
  public class FruitAdapter extends RecyclerView.Adapter&lt;FruitAdapter.ViewHolder&gt;{
  
      private List&lt;String&gt; mFruitList;
  
  
      **//if I use below, I got the Problem
      //ViewHolder holder;**
  
      static class ViewHolder extends RecyclerView.ViewHolder {
          View fruitView;
  
          TextView fruitName;
  
          public ViewHolder(View view) {
              super(view);
              fruitView = view;
  
              fruitName = (TextView) view.findViewById(R.id.fruitItemName);
          }
      }
  
      public FruitAdapter(List&lt;String&gt; fruitList) {
          mFruitList = fruitList;
      }
  
      @Override
      public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
          View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.fruit_item, parent, false);
  
          //this works, but if holder is class member,then problems happen
          final ViewHolder holder = new ViewHolder(view);
          //holder = new ViewHolder(view);
  
          holder.fruitView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  int position = holder.getAdapterPosition();
                  String fruit = mFruitList.get(position);
                  Toast.makeText(v.getContext(), "you clicked view " + fruit, Toast.LENGTH_SHORT).show();
              }
          });
  
          return holder;
      }
  
      @Override
      public void onBindViewHolder(ViewHolder holder, int position) {
          String fruit = mFruitList.get(position);
          holder.fruitName.setText(fruit);
      }
      @Override
      public int getItemCount() {
          return mFruitList.size();
      }
  
  }
  </code></pre>