Top "Android-livedata" questions

Android LiveData holds the value and allow it to observe changes and also respects lifecycle of the app components.

LiveData remove Observer after first callback

How do I remove the observer after I receive the first result? Below are two code ways I've tried, but …

android observers android-room android-livedata
Observing LiveData from ViewModel

I have a separate class in which I handle data fetching (specifically Firebase) and I usually return LiveData objects from …

android android-architecture-components android-livedata android-viewmodel
LiveData update on object field change

I'm using Android MVVM architecture with LiveData. I have an object like this public class User { private String firstName; private …

android observable android-livedata android-viewmodel
Why LiveData observer is being triggered twice for a newly attached observer

My understanding on LiveData is that, it will trigger observer on the current state change of data, and not a …

android android-architecture-components android-livedata
Notify Observer when item is added to List of LiveData

I need to get an Observer event when the item is added to the List of LiveData. But as far …

android kotlin android-livedata
Difference of setValue() & postValue() in MutableLiveData

There are two ways that make change value of MutableLiveData. But what is difference between setValue() & postValue() in MutableLiveData. …

android android-livedata mutablelivedata
MutableLiveData with initial value

How I can initialize MutableLiveData with initial value? I'm looking for something like: val text = MutableLiveData<String>("initial …

android kotlin android-livedata
LiveData.getValue() returns null with Room

Java POJO Object public class Section { @ColumnInfo(name="section_id") public int mSectionId; @ColumnInfo(name="section_name") public String mSectionName; …

android android-room android-architecture-components android-livedata
How to clear LiveData stored value?

According to LiveData documentation: The LiveData class provides the following advantages: ... Always up to date data: If a Lifecycle starts …

android android-architecture-components android-livedata
How and where to use Transformations.switchMap?

In recent Android Architecture Components library released by Google, we have two static functions in the Transformations class. While the …

android android-architecture-components android-livedata