I'd like to implement ListView and each item have multiple tags like StackOverflow list (a kind of master-detail style view).
Each tag in items is enumerated by tags string array.
The tags are no need to be changed/filtered when it first showed so that I think it does NOT need to use an adapter (an adapter is for binding between data model and view, right?). Moreover, I think using adapter in each item may cause performance issue in order to process additional bindings.
Is there any workaround to add ListView items without using Adapter?
For reference, in C#, listView.Items.Add("item1"); can display items simply.
As @Android-Developer noted, it is impossible to add arrays to ListView without Adapter.
listViewTopics.setAdapter(new ArrayAdapter<Topic>(CurrentActivity.this, R.layout.item_tag, topics));
above single-line code is simplist way to show array items(topics in this example) to ListView.
There is no option to create list with adapter. but yes you can use the default Array Adapter for list view.
List<String> values = new ArrayList<>();
values.add("Lesson 1.");
values.add("Lesson 2.");
values.add("Lesson 3.");
values.add("Lesson 4.");
ArrayAdapter<String> arrayAdapter = new ArrayAdapter<String>
            (this, android.R.layout.simple_list_item_1, values);
listView.setAdapter(arrayAdapter);
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With