gurehbgui
gurehbgui

Reputation: 14694

how to refresh the elements in a adapter without starting a new activity?

I have the following situation: I have a singleton controller which contains a List<Foo>

when my activity starts I load the items to my BaseExpandableListAdapter

the problem: When I now delete a item form the singleton List it gets net deletet in the view. Only when I start the whole activity again. How to solve this without starting the whole activity again?

Upvotes: 0

Views: 60

Answers (2)

Booger
Booger

Reputation: 18725

public void notifyDataSetChanged () Added in API level 1

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

http://developer.android.com/reference/android/widget/ArrayAdapter.html#notifyDataSetChanged%28%29

Upvotes: 1

Jeffrey Klardie
Jeffrey Klardie

Reputation: 3028

When you change the database that is used by the adapter, you should call notifyDataSetChanged() on the adapter.

Upvotes: 1

Related Questions