Я создаю объекты из json с jackson, и я хочу показать эти объекты в expandableListView
.Как сопоставить этот список объектов с расширяемым списком просмотров?
JSON выглядит следующим образом:
[
{
"name": "Pete",
"profile_img": "img001",
"relations": {
"is_working_with": [],
"is_in_course_with": [
{
"profile_img": "img002",
"name": "Jack"
}
],
"is_friends_with": [
{
"profile_img": "img003",
"name": "Stacey"
},
{
"profile_img": "img002",
"name": "Jack"
}
]
}
},
{
"name": "Jack",
"profile_img": "img002",
"relations": {
"is_working_with": [{
"profile_img": "img003",
"name": "Stacey"
}],
"is_in_course_with": [
{
"profile_img": "img001",
"name": "Pete"
}
],
"is_friends_with": [
{
"profile_img": "img003",
"name": "Stacey"
},
{
"profile_img": "img001",
"name": "Pete"
}
]
}
}
]
И мои Java классы:
public class Student {
@JsonProperty("name")
String name;
@JsonProperty("profile_img")
String profileImg;
@JsonProperty("relations")
Relations relations;
//Constructors
//Setter, Getter
}
public class Relations {
@JsonProperty("is_working_with")
List<IsWorkingWith> isWorkingWith;
@JsonProperty("is_friends_with")
List<IsFriendsWith> isFriendsWith;
@JsonProperty("is_in_course_with")
List<IsInCourseWith> isInCourseWith;
//Constructors
//Setter, Getter
}
public class IsWorkingWith {
@JsonProperty("name")
String name;
@JsonProperty("profile_img")
String profileImg;
}
public class IsFriendsWith {
@JsonProperty("name")
String name;
@JsonProperty("profile_img")
String profileImg;
}
public class IsInCourseWith {
@JsonProperty("name")
String name;
@JsonProperty("profile_img")
String profileImg;
}
Я пытался продлить BaseExpandableListAdapter
, и я получил это работает для представлений группы, но, как я укажите, какой атрибут моего объекта Student
представляет дочерние элементы в списке.
В основном я хочу, глядя, как это:
Как я должен создавать элементы в представлении ребенка?