Reputation: 6381
I am developing in Android, and try to get the LiveData<List<customType>>
via following function.
private fun getDataList(): LiveData<List<customType>> {
return room.getData()
}
And I create a parameter like the following:
private var customLiveData = MutableLiveData<List<customType>>()
How to set the getDataList()
to customLiveData
Thanks in advance.
Upvotes: 0
Views: 111
Reputation: 11477
LiveData<T>
cannot be set directly into MutableLiveData<T>
. However, you can use the value property
to set the value of liveData
to mutableLiveData
, like,
customLiveData.value = getDataList().value
Upvotes: 1