Sectioned recyclerview Header and sub items in android

523 Views Asked by At

I've HashMap key and JSONArray in Adapter. How to set header as key and array objects as sub items in RecyclerView?

Follwing is the HashMap format for first and second positions getting at adapter class. how to set it in Adapter?

  0 [{"Imgo":"003f2e1f.jpg"},{"Imgo":"063f2e1f.jpg"}] 
   1 [{"Imgo":"003f2e1f.jpg"}]

I'm able to set the header properly. Dont know how to insert the subitems in each header.

1

There are 1 best solutions below

0
On BEST ANSWER

By creating custom adapter view and passing header array and and subitems array seperately in adapter parameters. I ended up with this logic and it works fine. Created seperate header view_holder and subitems viewholder with seperate xml views. The logic will be helpful for others. If any doubts comment here.