title: Why does OnClickListener on a ViewHolder don't work?
body: <p>I'm trying to implement a way to handle item selection on a <code>RecyclerView</code>. I personally don't like the way suggested in some answers on SO of passing through gestures, and I thought that implementing an <code>OnClickListener</code>, as suggested <a href="https://guides.codepath.com/android/Using-the-RecyclerView#handling-touch-events" rel="noreferrer">here</a> and <a href="https://stackoverflow.com/questions/24885223/why-doesnt-recyclerview-have-onitemclicklistener-and-how-recyclerview-is-dif">here</a>, was waaay cleaner. </p>
  
  <p>The fact is that... this pattern doesn't actually work! I'm really not able to understand why my <code>OnClickListener.onClick</code> is <strong>never</strong> called. It's kinda like another method intercepts the click before <code>onClick</code> can take care of it.</p>
  
  <p>This is my code:</p>
  
  <pre><code>    public class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
          TextView tvName;
          ImageView star;
  
          public ViewHolder(View itemView) {
              super(itemView);
  
              tvName = (TextView) itemView.findViewById(R.id.CHAT_ITEM_name);
              star = (ImageView) itemView.findViewById(R.id.CHAT_ITEM_star);
  
              Fonts.setTypeface(tvName, regular);
          }
  
          @Override
          public void onClick(View view) {
              int position = getLayoutPosition();
              select(position);
          }
      }
  </code></pre>
  
  <p>Unfortunately it's very important for me to able to access the position of the clicked item in the whole dataset, in order to remove it, so doing something like <code>indexOfChild</code> isn't acceptable too: I tried, but this method gives you the position of the item in the <em>visibile</em> part of the list, thus making <code>list.remove(position)</code> impossible.</p>