Created
June 4, 2020 17:08
-
-
Save MasterAlish/9fe008727a0a49dbe5b1f23a3ad4de97 to your computer and use it in GitHub Desktop.
Merge multiple LiveData into one
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
val liveData1 = MutableLiveData<String>() | |
val liveData2 = MutableLiveData<String>() | |
val liveDataMerger = MediatorLiveData<String>() | |
liveDataMerger.addSource(liveData1) { liveDataMerger.value = it } | |
liveDataMerger.addSource(liveData2) { liveDataMerger.value = it } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment