Skip to content Skip to sidebar Skip to footer

Populate Listview From List

I am getting data in List. It is in the following format. AAA 123 456 BBB 235 156 CCC 458 425 I would like to display first column in the listv

Solution 1:

I think you have to create separate list for first column.

List<String> firstColumn = newArrayList<String>();
for (List<String> row : acNames) {
    firstColumn.add(row.get(0));
}
ArrayAdapter<String> adapter1 = newArrayAdapter<String>(getBaseContext(), R.layout.listitem, firstColumn);

EDITED

List<String> firstColumn = newArrayList<String>();
for (String[] row : acNames) {
    firstColumn.add(row[0]);
}
ArrayAdapter<String> adapter1 = newArrayAdapter<String>(getBaseContext(), R.layout.listitem, firstColumn);

Post a Comment for "Populate Listview From List"