1

Im trying to show and endless scroll screen within my app. Im not using new Paging library, so every time I detect bottom scroll reached I request a new list to data do show. I do use LiveData to post that data to the UI and here its when my doubt arrise. Eevery time I pull a new list of data to show, LieData will post that list and as I see I do have some options to handle that:

  1. Let the LiveData to push every new List of data requested and within the adapter implement some sort of loadData which basically add all data to existing list, and call notifyItemRangeInserted
  2. Keep a complete list of data in the ViewModel, and let LiveData push the whole list every time and implement UtilDiff on the adapter, which ends up with duplicated list of data that may grow to a danger size.

Which would be the right approach to take (not only between those listed here)

0 Answers0