Skip to content Skip to sidebar Skip to footer

Two Way Binding Cannot Resolve A Setter

I am trying to learn about data binding I have my CreditCardViewModel class which is bind in my fragment as follows public class CreditCardValidatorFragment extends Fragment { pr

Solution 1:

Make it your private variable to the public in your ViewModel

publicMutableLiveData<String> firstName = new MutableLiveData<>();
publicMutableLiveData<String> lastName = new MutableLiveData<>();
publicMutableLiveData<Long> ccNumber = new MutableLiveData<>();
publicMutableLiveData<Integer> ccType = new MutableLiveData<>();
publicMutableLiveData<String> exp = new MutableLiveData<>();
publicMutableLiveData<Integer> cvv = new MutableLiveData<>();

And you have to convert your integer to string

android:text="@={String.valueOf(creditCardViewModel.cvv)}"

Post a Comment for "Two Way Binding Cannot Resolve A Setter"