Can someone please explain me what is the difference between the following?
notifyDataSetChanged();
notifyDataSetInvalidated();
invalidateViews();
invalidateData();
I have read the doc but wasn't sure what is the actual difference.
Can someone please explain me what is the difference between the following?
notifyDataSetChanged();
notifyDataSetInvalidated();
invalidateViews();
invalidateData();
I have read the doc but wasn't sure what is the actual difference.
They are so different. notifyDataSetChanged()
is called when you've made some change inside your Adapter
and the current data is still valid. notifyDataSetInvalidated()
is called when some event happened that makes that the current Adapter
is no longer available and observers should not expect any updates from it.
As per the documentation:
public void notifyDataSetInvalidated ()
Added in API level 1
Notifies the attached observers that the underlying data is no longer valid or available. Once invoked this adapter is no longer valid and should not report further data set changes.