How to make EditText observe a ViewModel's LiveData and forward user input to the ViewModel without using data binding
I also ran into this problem since I don't like the databinding library. I did as @kAliert said, but in my ViewModel
to keep the logic there. I just added a simple catch on the function that receives my text changes events in the ViewModel
. It works well.
fun editTextChanged(newText: String) {
if (newText == textLiveData.value) {
return
}
}