You can do this even simplier:
android:text= "@{@string/generic_text(profile.name)}"
you string should be like this:
<string name="generic_text">My Name is %s</string>
Edit:
-
Of course you can use as many variables as you need:
android:text= "@{@string/generic_text(profile.firstName, profile.secondName)}" <string name="generic_text">My Name is %1$s %2$s</string> -
It works just because it’s designed in data binding. More in docs: https://developer.android.com/topic/libraries/data-binding/expressions#resources