https://kotlinlang.org logo
Title
u

user

07/03/2022, 4:11 PM
changing value of a LiveData on click of button only. But the observer's onChange is getting called even on onCreateView of fragment in Kotlin Android I have a LiveData in my ViewModel:- private val _toastMessage = MutableLiveData() val toastMessage get() = _toastMessage And this is the only way I am changing it's value(on click of a submit button in the fragment):- fun onSubmitClicked(){ Log.i(LOG_TAG, "submit button clicked") uiScope.launch { if(!myChecksForEditTextValuesSucceeded()) { _toastMessage.value = 0 }else{ _toastMessage.value = 1...