Android Data Binding concat two strings for a TextView

concate strings using grave accent (`)

android:text="@{`Hello ` + user.firstName}"/>


Using string expressions:
android:text="@{@string/location(user.city,user.state)}"
in your strings.xml

<string name="location">%1$s, %2$s</string>

Find More: https://stackoverflow.com/questions/40039942/i-want-to-concat-two-strings-for-a-textview-in-android-data-binding-api

No comments:

Post a Comment

Popular Posts