I have a very simple code in XML:
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="textPassword"
android:text="@={viewModel.password}"
android:enabled="@{viewModel.inputEnabled}">
Now when viewModel.inputEnabled
is a MutableLiveData<Boolean>
underneath, it simply doesn't work, edit is always enabled, regardless of value of inputEnabled
. However, it takes only to change inputEnabled
to an ObservableField<Boolean>
(and switch setValue
to set
) such that it immediately starts working.
Why is that so? How can I make MutableLiveData
work correctly?
Note, that this field is used in three places (to enable/disable form during processing).