title: Why automatically a button gets selected for another position when scrolled in Recycler View
body: <p>I am using recycler view to show a list which contains 12 items. 3 to 4 items will be viewable at once. I have show more button in each card row. If I click show more button of first card row, when I scroll down show more button of another card row will be selected automatically. Why will this happen and how can I fix this.</p>
  
  <p>Below is the code of how am I setting the adapter:</p>
  
  <pre><code>ToadlineAdapter toadlineAdapter = new ToadlineAdapter(mContext, getData1());
   recyclerView.setAdapter(toadlineAdapter);
   toadlineAdapter.setClickListener(this);
   recyclerView.setLayoutManager(new LinearLayoutManager(getActivity())); 
  </code></pre>
  
  <p>My Adapter Code:</p>
  
  <pre><code>public class ToadlineAdapter extends RecyclerView.Adapter&lt;ToadlineAdapter.MyViewHolder&gt; implements ToadlineCommentAdapter.ClickListener {
  
      private ClickListener clickListener;
      private SwipeRefreshLayout.OnRefreshListener clickListener1;
      private LayoutInflater inflater;
      Context mContext;
      List&lt;TimelineDataStore&gt; data = Collections.EMPTY_LIST;
      public ToadlineAdapter(Context context, List&lt;TimelineDataStore&gt; data) {
  
          inflater = LayoutInflater.from(context);
          this.data = data;
          mContext = context;       
      }    
  
      @Override
      public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {    
          View view = inflater.inflate(R.layout.single_card_row, parent, false);
          MyViewHolder viewHolder = new MyViewHolder(view);
          return viewHolder;
      }    
  
      @Override
      public void onBindViewHolder(MyViewHolder holder, int position) {
          TimelineDataStore current = data.get(position);
  
          if (clickedPosition.equals("post")) {
              holder.postHeader.setText(current.postHeader);
              holder.postDescription.setText(current.postDescription);        
          }    
      }
  
      @Override
      public int getItemCount() {    
          return data.size();
      }
  
      public void setClickListener(ClickListener clickListener) {
          this.clickListener = clickListener;
      }
  
      public void setClickListener1(SwipeRefreshLayout.OnRefreshListener clickListener1) {
          this.clickListener1 = clickListener1;
      }
  
      @Override
      public void itemClicked(View view, int position) {
  
      }    
  
      // View Holder object for Recycler View
      class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, SwipeRefreshLayout.OnRefreshListener, ToadlineCommentAdapter.ClickListener {
  
          TextView postHeader, postDescription;          
  
   public MyViewHolder(View itemView) {
              super(itemView);
              itemView.setOnClickListener((View.OnClickListener) this);
              postHeader = (TextView) itemView.findViewById(R.id.textViewTitle);
              postDescription = (TextView) itemView.findViewById(R.id.textViewPostDescription);
              mCardView = (CardView) itemView.findViewById(R.id.card_view);
              mShowMore = (ImageButton) itemView.findViewById(R.id.buttonSeeMore);
              mShowLess = (ImageButton) itemView.findViewById(R.id.buttonSeeLess);     
  
              mShowMore.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {    
                      int clickedPosition = getAdapterPosition();
                      TimelineDataStore current = data.get(clickedPosition);
  
                      current.postDescription = data.get(clickedPosition).postDescription;
  
                      postDescription.setVisibility(View.VISIBLE);
                      pollPostImages.setVisibility(View.VISIBLE);
                      mShowMore.setVisibility(View.GONE);
                      mShowLess.setVisibility(View.VISIBLE);         
                  }    
              });    
  
              mShowLess.setOnClickListener(new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {    
                      postDescription.setVisibility(View.GONE);
                      pollPostImages.setVisibility(View.GONE);
                      mShowMore.setVisibility(View.VISIBLE);
                      mShowLess.setVisibility(View.GONE);    
                  }    
              });
  }
  </code></pre>