In the document for the method notifyDataSetChanged of class BaseAdapter noted that “Notifies the attached observers that the underlying data has been changed and any View reflecting the data set should refresh itself.”
Supposed I changed the 3rd element in my string array (array data for the ListView), what “any View reflecting the data set should refresh itself” means ? Does the 3rd view item in my list view be notified ?
Also, how is notifyDataSetChanged() and getView() concerned ?
It means that any view which shows/is based on/uses that data(the string array in your case) should be invalidated(remeasured, redrawn) in order to show the user the new set of data.
No, the parent
ListViewwill be notified. When you set the adapter on aListView, an observer(from theListView) will be set for that adapter. CallingnotifyDataSetChangedon the adapter will announce that observer from theListViewthat something has happen to the data. At this moment theListViewwill recreate the rows to show the new data.I’m not sure I understand what you ask. The
getViewmethod of an adapter is used by theListViewto obtain a new row each time this is required. When you callnotifyDataSetChangedon the adapter this will trigger the observer in theListView. As it’s time to recreate the list, theListViewwill call thegetViewmethod of the adapter to show the necessary number of rows(the ones visible on the screen). So each time you callnotifyDataSetChangedthegetViewmethod will be called for the visible rows.