I wanted to populate a nested ArrayList. Below is the JSON response from the server. Now I want sectionName as the headerView and sectionItems as the Child view of that header. So That, this layout will look like categorized items. I have researched the same but couldn't able to find any easy and efficient solution. I don't want to create a separate flatten list because that would cost me time. Now, How can I achieve this layout. PS: I don't want to use any external library.
"data": [
{
"sectionName": "Fruits",
"sectionItems": [
{
"id": "123",
"name": "Apple",
"image": "url",
"price": "120",
"quntity": "600gm"
},
{
"id": "234",
"name": "Orange",
"image": "url",
"price": "340",
"quntity": "2kg"
},
{
"id": "334",
"name": "Banana",
"image": "url",
"price": "340",
"quntity": "2kg"
}
]
},
{
"sectionName": "Paints",
"sectionItems": [
{
"id": "345",
"name": "Red",
"image": "url",
"price": "120",
"quntity": "1l"
},
{
"id": "346",
"name": "White",
"image": "url",
"price": "120",
"quntity": "1l"
},
{
"id": "347",
"name": "Purple",
"image": "url",
"price": "120",
"quntity": "1l"
}
]
}
EDIT: I have implemented a nested recycler view but couldn't able to render all the child element. there are more than 80 items on the nested list but I can see only the 18.