0

I need to show a list of data which can be expanded further. Here for showing the list, I've used RecyclerView, but I'm open to use any other widget too. This list should be able to do following tasks:

  1. Add an item at any given specific position and not only at end or start of the list
  2. Pinch in and Pinch out for expanding and collapsing effect
  3. The list will be expanded upto 6 levels so simple expandable listview wont work in this case

Eg.

  1. List of years
  2. Every year contains list of quarters
  3. Every quarter contains list of months
  4. Every month contains list of weeks
  5. Every week contains list of days
  6. Every day contains list of hours

so here I will first show all years, and any year can be further expanded to its quarters followed by months and so on

for doing this, i need to be able to add an item at a particular desired position in the list means if there are 5 years viz. 2011, 2012, 2013, 2014, 2015. I can expand only 2012 and show a list like 2011, quarter 1 of 2012, quarter 2 of 2012, quarter 3 of 2012, quarter 4 of 2012, 2013, 2014, 2015.

Himanshu
  • 13
  • 1
  • 4
  • Your question is too wide. You should ask here about specific problem, preferable with code sample. – Divers Jul 21 '16 at 06:55
  • The only concern is add an item at a specific location in recycler view without refreshing the recyclerview completely, but in body I've just explained the scenario where it will be asked. Rest of the part will be handled well if we can insert an item at a specific location and not in end of lists only – Himanshu Jul 21 '16 at 07:08

1 Answers1

1

You should add your item in data set which your adapter use to show in RecyclerView, after that call

adapter.notifyItemInserted(position)

Doc

Divers
  • 9,531
  • 7
  • 45
  • 88