sliwkacz
sliwkacz

Reputation: 387

Updating android listView adapter's items' view

I'd like to change my listView items dynamically. The algorithm goes like this:

1.I create the default view for my listView using adapter and show it to user. The list item contains Imageview, textview and another imageview which is invisible. 2.The data is beeing dowloaded in the meantime. 3. after my data is downloaded, I'd like to check whether my listview contains any of downloaded items. If yes, I want to make visible the previously invisible ImageView for this item.

Should I add some kind of method to my adapter, call it and then call invalidateViews(), notifyDataSetChanged(), or notifyDataSetInvalidated()? Or maybe there is some kind of standard way to find my adapter's item by Id or sth and then make visible the imageview for this item?

This list update operation is the only one left to implement for me.

Upvotes: 0

Views: 716

Answers (2)

Braj
Braj

Reputation: 2160

Should I add some kind of method to my adapter, call it and then call invalidateViews(), notifyDataSetChanged(), or notifyDataSetInvalidated()?

Yes, exactly.

maybe there is some kind of standard way to find my adapter's item by Id or sth and then make visible the imageview for this item?

Above mentioned way is enough. There is no such standard or special way to do it AFAIK.

Upvotes: 1

Baschi
Baschi

Reputation: 1128

Read the Displaying Bitmaps Efficiently introduction and in particular the part about Handle Concurrency. This will give you all the information you need.

Upvotes: 1

Related Questions