I have experienced a weird behavior of MutableLiveData objects as they are sometimes observed continuously even without change in the data in it. As of my knowledge it should be observed only when it comes to active state from inactive state or the data in it has been modified.
In my Viewmodel:
val liveData = MutableLiveData<Any>()
In fragment:
viewModel.liveData.observe(this, Observer { response ->
//stuff to do and it is called continuously
}
})
Can you help me understand this behavior or Is there any way to avoid this.
Thanks in advance.