Ofir Bar
03/17/2020, 10:11 AMViewModel
.
I change their values one after another:
advertisementGoal.value = editModeInitialAdvertisement!!.goal
advertisementTargetUserType.value = editModeInitialAdvertisement!!.userTypeTarget
selectedExpertiseField.value = editModeInitialAdvertisement!!.expertiseField.id
Is this a race condition? or do LiveData
in the UI trigger onChange()
in order?Araib
03/17/2020, 1:34 PMsetValue()
for LiveData
and as per my understanding setValue()
gets triggered almost instantly so no race condition should happen. It could be that if you used postValue()
of LiveData
then a race condition could happen since postValue()
runs on background thread. I might be wrong here though so please feel free to correct me..