Reputation: 15
I'm trying to create a screen that displays multiples items. For this, I've created a listview but I'm not sure how to approach how to add/remove items from it. Since I'm using custom listview items, I've created my own listadapter but now I need a way to add items on a button click.
Is there a way to create listview that can take an indefinite amount of items (instead of passing it in an fixed length array of View objects)? Also what's the best way to remove items from listviews? setVisibility?
Upvotes: 0
Views: 219
Reputation: 3485
when you add item and remove item from list then need to notify adpter so
adapter.notifyDataSetChenged();
or in List you can add no of item
Upvotes: 1
Reputation: 3771
Add new items to your data and use:
adapter.notifyDataSetChenged();
You can also remove items this way
Upvotes: 0