private var number = MutableLiveData(0)
fun addOne(){
number.value?.let { it + 1 }
}
I would like to increase my mutableLiveData by 1 all the time using my function.
But it still shows 0. What could be wrong there ?
>Solution :
you are not change live data value …you are just get the value :
you should
number.value = number.value!! + 1