I have a question that I would love to get an answer on.
I have two arrays, let’s say:
String[] name = {"Name Nameson", "Second Name"};
String[] number = {"111 11 111", "222 22 222"};
I want my ListView to have two TextViews into one item.(I tried to illustrate this with a picture).
I manage to get f.ex. my name array into the listview with a simple
lv.setAdapter(new ArrayAdapter<String>(this, R.layout.single_name, name));
I have my main.xml with my ListView in it, single_name.xml and single_number.xml in my layout-folder.
Since I’m new to this site I’m not allowed to add a picture, I will try to illustrate it here:
HEADER
(item one)
Name Nameson
111 11 111
(item two)
Second Name
222 22 222
And this continues depending on quantity of contacts.
Any help would be greatly appreciated 🙂
Thanks in advance!
You will need to build a custom Adapter as well a custom view to represent each row in your List.
Here’s an example of a simple adapter for a listview with 2 textviews and an imageview. Modify as you see fit to include your header and take out the imageview
}