Skip to content Skip to sidebar Skip to footer

Android Data Binding Two Way Binding With Array

I want to achieve two-way binding on a array with Data Binding in Android. This is a simplified version of the code I have:

Solution 1:

How about trying the following way by using ArrayList.

<data>
    <import type="java.util.ArrayList"/>
    <variable
        name="values"
        type="ArrayList&lt;Integer&gt;"/>
</data>

<EditText
    ...
    android:text="@={Converter.toString(values.get(0))} />

Post a Comment for "Android Data Binding Two Way Binding With Array"