Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android ListView Adapter notifyDataSetInvalidated() vs notifyDataSetChanged()

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?

like image 686
Spidy Avatar asked Jun 17 '11 00:06

Spidy


People also ask

What is notifyDataSetChanged in ListView?

It tells the ListView that the data has been modified; and to show the new data, the ListView must be redrawn.

What is notifyDataSetChanged in Android?

notifyDataSetChanged() Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.

How do I call a notifyDataSetChanged activity?

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.


1 Answers

Changed means the data set changed. Individual items updated, or items were added or removed. Invalidated means the data source is no longer available.

like image 102
adamp Avatar answered Sep 21 '22 17:09

adamp