https://kotlinlang.org logo
Title
g

gokul

07/18/2018, 6:19 AM
var productList = MutableLiveData<ArrayList<Fnblist>>() fun add(subitem: Subitem, position: Int) { productList.value?.get(position)?.subitems?.get(0)?.count = 2 } not observing on property change.. need help
:stackoverflow: 1
1
When using setvalue it's observing in activity. But when changing feild in livedata not observing.
e

edwardwongtl

07/18/2018, 6:49 AM
Because LiveData don’t know if the content of the object changed.
g

gokul

07/18/2018, 7:04 AM
Then. What's solutions for this
e

edwardwongtl

07/18/2018, 7:05 AM
add
productList.setValue(productList.value)
m

Mark Buikema

07/18/2018, 8:12 AM
it only observes changes of the list, not the items within the list