Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Import primitive types to layout with data binding library

I need one separate boolean variable within my item layout, which is intended to use as a row of recyclerView, to toggle the state of some views inside it.

I know, I have got an option to include that boolean into my model class and use that. I am just curious whether it is possible to use primitive types inside layout with the help of data binding library.

like image 711
SpiralDev Avatar asked Feb 05 '23 13:02

SpiralDev


1 Answers

Apparently, it's possible and easy.

 <data>
        <variable
            name="someBoolean"
            type="boolean" />

        <variable
            name="someInt"
            type="int" /> 

        <variable
            name="someWrapperBoolean"
            type="java.lang.Boolean" />

        <variable
            name="someWrapperInt"
            type="java.lang.Integer" />
    </data>
like image 160
SpiralDev Avatar answered Feb 07 '23 13:02

SpiralDev