I'm trying to use android two-way databinding
with checkBox
in a fragment.
I have multiple fragments in viewPager
with custom FragmentStatePagerAdapter
and one viewModel
in first fragment
.
I have a checkbox with the code below:
<CheckBox
android:id="@+id/checkbox_accept_rules"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="@={viewmodel.isAccept}"
android:gravity="right"
android:text="text..." />
In viewModel:
private final ObservableBoolean isAccept = new ObservableBoolean(false);
When I go to last fragment
and return to first one the checkBox
is not checked anymore, the color of the checkbox is true but the check icon is not there!
Had anyone this problem before?
Thanks in advance