I am trying to figure out the best method of displaying a json result in a listview. I have the following json response coming from a WCF RESTful service:
[
{
"Class": "Lorem",
"Company": "Ipsum",
"Id": "XXXX",
"Name": "Avent"
},
{
"Class": "Consectetur",
"Company": "Adipiscing",
"Id": "YYYYY",
"Name": "Nulla"
}
]
I've read several examples of arraylist to listview, but none with a multiple column issue I'm trying to get around. I want the column to display the "Name" field large, and the "Company" name beneath it in smaller text. I'd like to store the Id as some sort of key for when the user clicks on the item, to call it in another function, but I'm not sure how best to do that.
Group Class:
public class Group {
private String Id;
private String Name;
private String Class;
private String Company;
}
gson parsing statement:
ArrayList<Group> groups = gson.fromJson(jsonString, new TypeToken<ArrayList<Group>>() {}.getType())
I've been using an ArrayAdapter, but I get the feeling I may need to create a custom Adapter for this. Do I have to use a HashMap to make this work? Do I need to transform my arraylist somehow?