Error:cannot generate view binders java.util.ConcurrentModificationException
occurs when trying to set an ObservableBoolean
value in XML.
XML:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Soy Milk"
android:onClick="@{() -> model.useSoy.set(true)}"
/>
Model:
public ObservableBoolean useSoy = new ObservableBoolean(false);
How can I fix this?
I got it running by calling a seperate setter method.
XML:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Soy Milk"
android:onClick="@{() -> model.setUseSoy(true)}"
/>
Model:
public ObservableBoolean useSoy = new ObservableBoolean(false);
public void setUseSoy(Boolean useSoy){
this.useSoy.set(useSoy)
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.