What is the difference? The android documentation doesn't have a description for notifyDataSetInvalidated(). I was thinking maybe you call that function to notify all registered listeners, but use notifyDataSetChanged() to not notify them?
It tells the ListView that the data has been modified; and to show the new data, the ListView must be redrawn.
notifyDataSetChanged() Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.
If you are accessing it from outside scope, you can get it from the ListView object and cast it so you can call notifyDataSetChanged(). Like so: ServerItemAdapter listAdapter = (ServerItemAdapter) listView. getAdapter(); listAdapter.
Changed means the data set changed. Individual items updated, or items were added or removed. Invalidated means the data source is no longer available.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With