As I have already explained the reasons behind this issue and also how to handle it in a different answer thread Here. Still i am sharing the solution summary here.
One of the main reasons notifyDataSetChanged()
won't work for you - is,
Your adapter loses reference to your list.
When creating and adding a new list to the Adapter
. Always follow these guidelines:
arrayList
while declaring it globally.arrayList
it will take care of it, but never loose the
reference.adapter.clear()
and arrayList.clear()
before
actually adding data to the list) but don't set the adapter i.e If
the new data is populated in the arrayList
than just
adapter.notifyDataSetChanged()
Hope this helps.