Global web icon
stackoverflow.com
https://stackoverflow.com/questions/55914752/when-…
When to use MutableLiveData and LiveData - Stack Overflow
LiveData has no public available methods to update the stored data. The MutableLiveData class exposes the setValue(T) and postValue(T) methods public and you must use these if you need to edit the value stored in a LiveData object.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/61223908/what-…
What is the correct way to observer LiveData? - Stack Overflow
Which of these approaches is better/correct? To have 1 observer to such LiveData object, and have the observer to implement the update logic for all views, making the necessary checks, etc. To have multiple observers to the LiveData object (or per interested view) and each observer only deals with the logic of that particular view.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/69042012/lived…
android - LiveData Vs StateFlow: Should we switch from Live data to ...
LiveData is a data holder that is lifecycle-aware, meaning it only delivers updates to observers that are in an active state. It is useful for holding data that needs to be observed and updated in the UI, such as data from a network request or a database query. State is a data holder that represents an immutable state value that can be observed.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/47515997/obser…
android - Observing LiveData from ViewModel - Stack Overflow
PS The asFlow makes a flow that makes LiveData activate at starting collect. I think the solution with MediatorLiveData or Transformations and attaching a dummy observer doesn't have differences using the Flow except for emitting value from LiveData is always observed in the ViewModel instance.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/62793850/obser…
Observing LiveData in ViewModel best practices - Stack Overflow
ViewModel uses a MediatorLiveData to observe changes of the LiveData that comes from repository. I've added the data as a source to observe changes and remove it after it triggers to prevent firing events multiple times when I get data multiple times.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/61417190/unres…
Unresolved reference: asLiveData while converting Flow to LiveData
So, when I try to convert the Repository's Flow to the LiveData with the help of asLiveData method, asLiveData is underlined and studio writes that it's an unresolved reference.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/68635436/what-…
What are the differences between StateFlow and LiveData?
I couldn't find the specific differences as there are complex examples on the internet. What are the differences in terms of performance? In which scenarios does it provide advantages? Using StateFlow with Kotlin Flow is advantageous. But what is the risk of not switching to StateFlow in a project using LiveData? Is Google deprecating LiveData? :)
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/58773453/kotli…
Kotlin Flow vs Android LiveData - Stack Overflow
I have some questions about Kotlin Flow I can observe LiveData from multiple Fragments. Can I do this with Flow? If yes then how? We can have multiple LiveData from a single LiveData using map&
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/54841587/diffe…
android - Different between ViewModel with LiveData vs ViewModel ...
I read many tutorial about viewmodel and livedata but i do not get actually use of livedata within viewmodel class in mvvm pattern. thanks in advance.
Global web icon
stackoverflow.com
https://stackoverflow.com/questions/44204978/how-t…
android - How to update LiveData of a ViewModel from background service ...
4 Take a look at the Android architecture guide that accompanies the new architecture modules like LiveData and ViewModel. They discuss this exact issue in depth. In their examples they don't put it in a service. Take a look at how they solve it using a "repository" module and Retrofit.