Concat Two Strings In TextView Using DataBinding

Sometimes we might need a functionality where we needs to concat two strings in xml only. So here are the different ways of how can we do it using databinding.

1. Using grave accent(`)

2. Using strings.xml

and in your string.xml file

3. Using concat()

4. Using string.format()

For above approach you need to import String class.

 

INVISIBLE vs GONE View in Android
Open Application Settings Screen Android

  • Arpit Patel

    Can I mix and match above use cases? For example
    android:text=”@{Hello + user.firstName.concat(user.lastName)}”