Reputation: 9926
In my application - i need to present ( in the UI ) some dynamic string collection.
This collection need to have ability to add/remove some string that comes from other component.
The string collection exist on some singleton class.
What is the easy way to show this dynamic collection ?
Thanks
Upvotes: 0
Views: 88
Reputation: 472
You can declare your string in a linked list, then you create a listview. You create a base adapter witch takes as arguments your string list and pass the adapter to the list view;
ArrayAdapter<String> adapter = new ArrayAdapter <>(this, android.R.layout.simple_list_item_1, yourStringValues)
listView.setAdapter(adapter)
your string items will be showed to the user, then you may want to implement listview's on touch listener in order to show a menu which can be used to delete an element
Upvotes: 1
Reputation: 6693
Upvotes: 1