I need to display contents (most likely just one index) from a 2-d string array in a listview.
I can create an arrayadapter for a 1-d array like this:
String[] values ... blah-blah
ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
listView.setAdapter(adapter);
This works just dandy. However, if I do this:
String[][] values ... blah-blah
ArrayAdapter<String[]> adapter = new ArrayAdapter<String[]>(this,
android.R.layout.simple_list_item_1, android.R.id.text1, values);
listView.setAdapter(adapter);
This, naturally, will display the arrays in the array, so to speak, and not the contents.
The question is, how to I display f.ex. the first or second index of the 2-d array in the ListView?
In detail:
2-d array contents:
3,03-09-2012,text,moretext
2,03-09-2012,text,moretext
1,03-09-2012,text,moretext
I'd like to display f.ex. index[i][2] in the list.
I don't necessarily need to display all the indexes of each array, but I need to have access to them. Since each array contains several entries, among others an ID, I cannot just convert the information I want to display to a 1-d array, since then I'd lose the ID of each array.