I have a RecyclerView. Every layout contains expandle view within itself. With item click expandle view of clicked item is expands. And if I'll click on two items there is will be two items with expanded view in my RecyclerView. I need to close others item's expandles view with item click. Only one item with expanded expandle view must be in recycler.
How do I can make this?
public void onBindViewHolder(@NonNull ViewHolder holder, int position) {
holder.exp.collapse();
holder.itemView.setOnClickListener(v -> {
holder.exp.expand();
});