luizgrp / SectionedRecyclerViewAdapter

An Adapter that allows a RecyclerView to be split into Sections with headers and/or footers. Each Section can have its state controlled individually.
MIT License
1.68k stars 372 forks source link

Unable to get working mSectionAdapter.notifyDataSetChanged() for Example1Fragment #115

Closed jitenderdev closed 6 years ago

jitenderdev commented 6 years ago

I am unable to notify the adapter like we use to do with normal i.e. 'notifyDataSetChanged'

ATM

I have got it working by resetting the Recyclerview to Adapter mSectionAdapter=null; mSectionAdapter = new SectionedRecyclerViewAdapter(); mRvPlayers.setAdapter(mSectionGroupAdapter);

What am i doing is i am changing the data in sections and calling 'mSectionAdapter.notifyDataSetChanged()' but it is not working for me.

Am i missing something? Please guide.

jitenderdev commented 6 years ago

Got it working :)

ISSUE : By adding the same section with same header name it is not updating items. So need to remove the whole section and need to add whole section again.

Working Code

mSectionAdapter.removeAllSections();

Add Sections Again

mSectionAdapter.notifyDataSetChanged();