0

I've been looking at recyclerview lately and I'm not understanding the difference between multipleview with one adapter versus ConcatAdapter with each adapter having its own view.

Say for example I have a recyclerview with 5 differents views

Why multiple viewType over ConcatAdapter ?

Biscuit
  • 4,840
  • 4
  • 26
  • 54
  • And how would you implement multipleview adapter with completly different items type or multiple collections? ... Pros and cons are opinion-based – Selvin Oct 18 '21 at 10:50
  • something such as this https://droidbyme.medium.com/android-recyclerview-with-multiple-view-type-multiple-view-holder-af798458763b with 3 differents viewType: header, footer and item I've updated the question to be less opnion-based. – Biscuit Oct 18 '21 at 11:05
  • in this example item in the adapter is the same - Employee – Selvin Oct 18 '21 at 11:10
  • I finally got what you meant, ConcatAdapter is for different objects while multiple viewtype is the same object being rendered differently – Biscuit Oct 18 '21 at 11:12
  • sencond is multiple collection ... as position can only be pointed in one collection. if you wana use second collection then you have to calculate position in this collection by substracting first collection length (like somethig[5] and somethingelse[6] both have 11 items but to get 5 element you have to in fact get element 0 from second array - with ConcatAdapter there is no problem as each adapter has its own collection) – Selvin Oct 18 '21 at 11:14
  • Okay thank you for clearing my doubts – Biscuit Oct 18 '21 at 11:21

0 Answers0