user3170375
user3170375

Reputation: 1

Add item to ListView dynamically

I can't seem to figure out how ListView works. I need to add an item to the ListView at runtime, just like this picture:

Screenshot

I'm not able to use a database, so the data must be in the adapter or in an ArrayList.

Upvotes: 0

Views: 572

Answers (1)

Yjay
Yjay

Reputation: 2737

If you need to add a new item to a ListView after you have passed in your ListAdapter, simply add the new data to the underlying collection, and call notifyDataSetChanged() on your ListAdapter (Assuming you are using an adapter implementation derived from BaseAdapter).

Upvotes: 3

Related Questions