Reputation: 19723
How to add items to a ListView in Android during runtime?
Upvotes: 2
Views: 2482
Reputation: 165
Okay, i found a perfect example for this in the Android Sample Project "ApiDemos" (List12.java)
Upvotes: 2
Reputation: 36484
There must be an adapter that backs this ListView
. The Adapter must have taken some datastore(ArrayList etc.) as an argument.
Add your items to this list(the datastore that you've supplied to the adapter) and then call notifyDataSetChanged
() method on your adapter.
Upvotes: 5