Is there any way I can transform an object of type LiveData<List<X>> to an object of type LiveData<PagedList<X>>?
Asked
Active
Viewed 162 times
0
Merov
- 1,028
- 1
- 14
- 29
Lilian Sorlanski
- 405
- 1
- 3
- 15
1 Answers
0
As much as i understood you can do it in the followed way:
class FirstType
class SecondType
val initType: LiveData<FirstType> = MutableLiveData<FirstType>()
val resultType : LiveData<SecondType> = Transformations.map(initType, ::convertTypes)
fun convertTypes(firstType: FirstType) : SecondType = SecondType()
upd:
What about converting List<T> to PagedList<T> try to look at:
How to convert a List<Object> to PagedList<Object> and vice-versa?
Merov
- 1,028
- 1
- 14
- 29
>` in `LiveData>`, see `List` into `PagedList`. Is there any way I can do that?
– Lilian Sorlanski Jul 09 '19 at 10:41