Open digmoy-techpro opened 3 years ago
@digmoy-techpro The approach used in this tutorial foe getting data from viewModel is wrong. We have to observe from the livedata.
It should be done as
mainActivityViewModel.getUser()
servicesLiveData.observe(this, Observer { serviceSetterGetter ->
wp7progressBar.hideProgressBar()
val msg = serviceSetterGetter.message
lblResponse.text = msg
})
as per the tutorial i have followed, the all steps were working fine but while calling the same api twice or thrice, the data in the view model is not getting updated and user is getting the previous value only.