Context in Android Databinding XML files

It is so easy guys, just don’t forget that DataBinding creates a field called context which you can access by default in your XML file. So you can write something like this:

   <variable name="name" type="String"/>
      app:text="@{StringUtils.format(context, name)}" />

And it will be just fine. You have the context from the parent view. Check it HERE.