I have a TextView which has a hardcoded string and I have a dynamic variable that I want to put at the end of this string. This is my code:
You can do this even simplier:
android:text= "@{@string/generic_text(profile.name)}"
you string should be like this:
My Name is %s
Edit:
Of course you can use as many variables as you need:
android:text= "@{@string/generic_text(profile.firstName, profile.secondName)}"
My Name is %1$s %2$s
It works just because it's designed in data binding. More in docs: https://developer.android.com/topic/libraries/data-binding/expressions#resources