Skip to content

XML Variables

Yogesh Choudhary Paliyal edited this page Oct 12, 2021 · 1 revision

XML Variables

To bind your view item with Adapter using dataBinding you have to create use these Variables name must be as follows

binding

Type should be same as your resource binding file. This can be used to update your views in callback, after changing the variable value in model, for example check UserListingActivity.
All Adapters layout using this variable

<variable
            name="binding"
            type="androidx.databinding.ViewDataBinding" />

model

Type should be same as model you are passing to Adapter.
Content layout using this variable

<variable
            name="model"
            type="com.techpaliyal.androidkotlinmvvm.model.BasicModel" />

listener

Type Any/Object, should be same as you passing while create Adapter.
Content & Error layout using this variable

<variable
            name="listener"
            type="com.techpaliyal.androidkotlinmvvm.model.BasicListener" />

message

Type will be String.
Error layout using this variable

<variable
            name="message"
            type="String" />