Skip to content Skip to sidebar Skip to footer

Notifydatasetchanged() Vs Invalidatedata()

Can someone please explain me what is the difference between the following? notifyDataSetChanged(); notifyDataSetInvalidated(); invalidateViews(); invalidateData();

Solution 1:

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.

Post a Comment for "Notifydatasetchanged() Vs Invalidatedata()"