Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android notifyDataSetChanged

I have a list which is filled with a custom ArrayAdapter.

I want to update a progress bar every second, so I am trying to use notifyDataSetChanged() in order to repaint the list but it doesn't seem to work.

like image 519
Gerardo Avatar asked Feb 27 '10 01:02

Gerardo


People also ask

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.

What does notifyDataSetChanged do in RecyclerView?

What does notifyDataSetChanged() do on recyclerview ? Notify any registered observers that the data set has changed. There are two different classes of data change events, item changes and structural changes. Item changes are when a single item has its data updated but no positional changes have occurred.

What is a base adapter in Android *?

BaseAdapter, as it's name implies, is the base class for so many concrete adapter implementations on Android. It is abstract and therefore, cannot be directly instantiated. If your data source is an ArrayList or array, we can also use the ArrayAdapter construct as an alternative.

What is the use of onBindViewHolder in Android?

onBindViewHolder. Called by RecyclerView to display the data at the specified position. This method should update the contents of the itemView to reflect the item at the given position. Note that unlike android.


1 Answers

How are you updating the List data structure that is feeding ArrayAdapter?

Please see my answer here: notifyDataSetChanged example

for issues regarding ArrayAdapters and updating the List that holds data for notifyDataSetChanged to work.

like image 150
jnosek Avatar answered Oct 04 '22 15:10

jnosek