Add your clickListenr to the viewHolder like this
public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener{
public CardView mCardView;
public TextView mTextView;
public MyViewHolder(View v) {
super(v);
mCardView = (CardView) v.findViewById(R.id.card_view);
mTextView = (TextView) v.findViewById(R.id.tv_text);
mCardView.setOnClickListener(this);
mTextView.setOnClickListener(this);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.card_view:
//Action when card_view is clicked
break;
case R.id.tv_text:
//Action when tv_text is clicked
break;
default:
break;
}
}
}