select and unselect RecyclerView item without using checkbox or radio button or etc

99 Views Asked by At

Select and Unselect items in recyclerview without using any checkbox or radio button or etc.

  • I want to select 1st recyclerview item on longclick and then all the other item on single click in recyclerview list.
  • Unselect item on single click as well on recyclerview list.

UPDATE()

    holder.itemView.setOnLongClickListener(View.OnLongClickListener {

                    if (selectedPosition == position) {
                        selectedPosition = -1
                        notifyItemChanged(position);
                    }
                    selectedPosition = position;
                    notifyItemChanged(position);}

After one long click i want to select and unselect item only on single click

0

There are 0 best solutions below