[Solved] How to implement two OnClickListeners on RecyclerView item click?


Remove below code from RecyclerView.ViewHolder

@Override
public void onClick(View v) {
    listener.onItemClick(v, getAdapterPosition());
}

And add listner event in “itemView” click as below:

((SelectedProjectItemHolder) holder).itemView.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if(listener != null){
                            listener.onItemClick(v, getAdapterPosition());
                        }
                        dataSet.remove(listPosition);
                        dataSet.add(listPosition, unselectedCards.get(listPosition));
                        notifyItemChanged(listPosition);
                    }
                });

solved How to implement two OnClickListeners on RecyclerView item click?