Why LiveData observer is being triggered twice for a newly attached observer

后端 未结 12 2080
北荒
北荒 2020-12-12 18:03

My understanding on LiveData is that, it will trigger observer on the current state change of data, and not a series of history state change of data.

12条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-12 18:25

    The solution I had was simply to start observing data when I need it and remove the observer as soon as it has retrieved the data. You won't get double triggering this way.

提交回复
热议问题