I know that it is possible to reference resources in layout by their resource id:
android:text=\"@{@string/resourceName}\"
However, I would
Kotlin version:
@BindingAdapter("template", "resId") fun TextView.setFormattedText(template: String, resId: Int) { if (template.isEmpty() || resId == 0) return text = template.format(resources.getString(resId)) }
in xml