How to notifyDataSetChanged to all recyclerview sections

469 Views Asked by At

I'm using section luizgrp sectionedrecyclerviewadapter with sections and headers , and on item select i change the text color then notifyData but it reflects only in one section , every section has a selected item colored , how can i notify the whole list?

 @Override
public void onBindItemViewHolder(RecyclerView.ViewHolder holder, final int position) {
    final ItemViewHolder itemHolder = (ItemViewHolder) holder;
    if(position == selectedPosition) {
        itemHolder.txtTime.setTextColor(Color.parseColor("#00aaff"));
        itemHolder.txtType.setTextColor(Color.parseColor("#00aaff"));
    } else {
        itemHolder.txtTime.setTextColor(Color.parseColor("#000000")); 
        itemHolder.txtType.setTextColor(Color.parseColor("#000000"));
    }


        itemHolder.rootView.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                selectedPosition=position;
                recyclerView.getAdapter().notifyDataSetChanged();
            }
        });
    }


}
0

There are 0 best solutions below