Room : LiveData from Dao will trigger Observer.onChanged on every Update, even if the LiveData value has no change

There is simple solution in Transformations method distinctUntilChanged.expose new data only if data was changed.

In this case we get data only when it changes in source:

LiveData<YourType> getData(){
    return Transformations.distinctUntilChanged(LiveData<YourType> source));

But for Event cases is better to use this:

Leave a Comment