In Yigit Boyar and George Mount\'s talk on Android Databinding they illustrate how easy it is to bind to TextWatcher\'s onTextChanged (at 13:41). O
Im using this method to handle on text change listener in android databinding.1st in your ViewModel class create LiveData variable, And also create getText method which returns LiveData object.
public MutableLiveData verifyCodes = new MutableLiveData<>(); public LiveData getCodes(){
return verifyCodes;
} Then in your xml files editText field set attribute on text bind with above liveData field
In databinding you already know how to create variable of viewModel class inside data tag i beleive.As example
Ok now your activity you have to observe liveData object we created inside viewModel class
mViewModel.getCodes().observe(this,new Observer< String>(){
@Override
public void onChange(String strings){
log.d("OnChange",strings);
}});You can perform any logic when text changing inside onChange method