Why does my activity doesn't see an observed object change?

后端 未结 3 697
萌比男神i
萌比男神i 2021-01-27 07:37

I\'m new to Android development and i am trying to understand Live Data with MVVM architecture. I am trying to make the main activity recognize when there is a change in an obje

3条回答
  •  抹茶落季
    2021-01-27 07:53

    In your repository, try changing this part:

    loggedInUser.setValue(response.body());
    

    to postValue function. like that:

    loggedInUser.postValue(response.body());
    

提交回复
热议问题