You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi,
This is not an issue but a question. There is no other way to ask a question.
Why you did not use an MediatorLiveData instead of observing 3 differents LiveData like you do: viewModel.isLoadingLiveData.observe(this, Observer<Boolean> { it?.let { vRefresh.isRefreshing = it } }) viewModel.reposLiveData.observe(this, Observer<List<Repo>> { it?.let { adapter.dataSource = it } }) viewModel.throwableLiveData.observe(this, Observer<Throwable> { it?.let { Snackbar.make(rv, it.localizedMessage, Snackbar.LENGTH_LONG).show() } }).
You could add those 3 different source inside the mediatorLiveData and thus observing one livedata in the your activity/fragment.
The text was updated successfully, but these errors were encountered:
Hi @Deep21 , maybe you are right, but in my case, I have 3 different data types inside livedatas. If I had wanted to merge ones I would have had some extra object to hold data.
Hi,
This is not an issue but a question. There is no other way to ask a question.
Why you did not use an MediatorLiveData instead of observing 3 differents LiveData like you do:
viewModel.isLoadingLiveData.observe(this, Observer<Boolean> { it?.let { vRefresh.isRefreshing = it } })
viewModel.reposLiveData.observe(this, Observer<List<Repo>> { it?.let { adapter.dataSource = it } })
viewModel.throwableLiveData.observe(this, Observer<Throwable> { it?.let { Snackbar.make(rv, it.localizedMessage, Snackbar.LENGTH_LONG).show() } }).
You could add those 3 different source inside the mediatorLiveData and thus observing one livedata in the your activity/fragment.
The text was updated successfully, but these errors were encountered: