I have a list of liveData, like List<LiveData<String>>
. I want to observe this list so that whenever the String
inside the LiveData
changes, it would notify the observer of the list with this String
.
How can I do this?
My list elements are strictly LiveData<String>
so, it can not be simplified to String
.
I know how to observe LiveData<String>
, but not List<LiveData<String>>
.
Please help.
Edit:
The element of the list is
LiveData<String>
because theString
it is coming from the internet. So, list elements are holding object ofLiveData<String>
.
If you want to observe a List<LiveData<String>>
, you would have to attach an observer to each element of the list. The list itself is not observable, only each LiveData element of it. So, simply: