Code Droid
Code Droid

Reputation: 10472

Iterate through ListView elements and find/modify particular view

I would like to iterate thru the views of a listview and stop on a particular view so I can turn on/off an indicator or remove the list element altogether. How can I locate a particular listview element? After such a change how can I make sure that the view will be redrawn if I am modifying it? Does the adapter need to be reset after removing a listview element for it to be removed?

In short, can you change/remove individual listview elements?

Upvotes: 0

Views: 805

Answers (1)

devunwired
devunwired

Reputation: 63303

Make your modifications on the ListAdapter (add/remove the item or update state) then call notifyDataSetChanged() to update the ListView. The adapter's getView() method will be called for each visible item so it can be updated and redrawn at that point.

Upvotes: 1

Related Questions