title: Where should I place setOnClickListener in a RecyclerView Adapter
body: <p>In tutorials on internet where they setOnClickListener in Adapter of RecyclerView they define it in two ways : either inside ViewHolder or inside BindViewHolder. </p>
  
  <p>My Question is which one is a better approach, Please recommend any another approach if available</p>
  
  <p>1) inside ViewHolder:</p>
  
  <pre><code>public static class ViewHolder extends RecyclerView.ViewHolder {
  
      public ViewHolder(View itemView) {
          super(itemView);
          tvSrc = (TextView) itemView.findViewById(R.id.tvSrc);
          itemView.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  Toast.makeText(v.getContext(), "inside viewholder position = " + getAdapterPosition(), Toast.LENGTH_SHORT).show();
              }
          });
      }
  </code></pre>
  
  <p>2) inside BindViewHolder</p>
  
  <pre><code>public void onBindViewHolder(DisplayTrainsAdapter.ViewHolder viewHolder, final int position) {
  
      viewHolder.tvSrc.setText(mDataset.get(position).strSrc);
      viewHolder.tvSrc.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View v) {
  
              Toast.makeText(v.getContext(), "position = " + getItemId(position), Toast.LENGTH_SHORT).show();
          }
      });
  }    
  </code></pre>