How do I bind a variable from an inner data class in layout file in kotlin?

Viewed 190

I am trying to bind value of a variable from an inner data class .But I am unable to access variable in the inner data class.I have given the outer data class inside <data> <<data>.

Please find below the data classes and layout.xml file.

data class User( val name:String ,val property:List<Property>)
data class Property(val propertyName:String, val owners:List<Owner>)
data class Owner(val ownerName:String)
<layout xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        xmlns:tools="http://schemas.android.com/tools">
        
     <data>
         <variable
             name="user"
             type="com..User" />
                
     </data>
     <LinearLayout>
         <TextView
             android:id="@+id/owner_textview"
             [...]
             android:text="{}"/>
        
         </<LinearLayout>
</layout>

I want the name of the Owner to be bound in the Textview. When i try to access using @{user.property[0].owners[0].ownerName}, it is not accessible. How can access the same?

0 Answers
Related