Im using DataBinding
Api for setting the views in android layouts. Here is my layout.
layout.xml
concate it with grave accent (`)
android:text="@{`Hello ` + user.firstName}"/>
You can concat it in multiple ways, check it here concat-two-strings-in-textview-using-databinding
In case of static string and other dynamic you can use this
android:text="@{`Hello ` + user.firstName}"/>
In case of dynamic data you can use this.
android:text='@{user.firstName+" "+user.lastName}'
if you want to concat String
resource with data from your model, you can do it in such way:
android:text='@{@string/release_date+model.release_date}'
The simplest way I found to be is to replace ''(single) in place of ""(double), For Eg. You have two variables,
<variable name="a" type="String" />
<variable name="b" type="String" />
Now to concatenate,
android:text='a + " " + b}'