Search code examples
androidmvvmviewmodelmutablelivedata

MutableLivedata observer triggering


I have a question about MutableLiveData in Viewmodel. Does just setValue function of MutableLiveData trigger observation? If we change content of MutableLiveData witout setValue, may it be triggered?


Solution

  • I doubt it. Only the mothods below dispatch events to observables:

    liveData.postValue("a");
    liveData.setValue("b");
    

    https://developer.android.com/reference/android/arch/lifecycle/MutableLiveData