Ragunath Jawahar
Ragunath Jawahar

Reputation: 19723

How to add items to a ListView during runtime?

How to add items to a ListView in Android during runtime?

Upvotes: 2

Views: 2482

Answers (2)

mikugo
mikugo

Reputation: 165

Okay, i found a perfect example for this in the Android Sample Project "ApiDemos" (List12.java)

Upvotes: 2

Samuh
Samuh

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

Related Questions