[英]ConcurrentModificationException building Android XML with data binding
Error:cannot generate view binders java.util.ConcurrentModificationException
,尝试在XML中设置ObservableBoolean
值时发生Error:cannot generate view binders java.util.ConcurrentModificationException
。
XML:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Soy Milk"
android:onClick="@{() -> model.useSoy.set(true)}"
/>
模型:
public ObservableBoolean useSoy = new ObservableBoolean(false);
我怎样才能解决这个问题?
我通过调用单独的setter方法使其运行。
XML:
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Soy Milk"
android:onClick="@{() -> model.setUseSoy(true)}"
/>
模型:
public ObservableBoolean useSoy = new ObservableBoolean(false);
public void setUseSoy(Boolean useSoy){
this.useSoy.set(useSoy)
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.