Android Data Binding: Express Yourself
George Mount
1253

George Mount So i refactored my app to use data binding. Now code base looks really clean. I like it. I am having trouble when i use rich text formatting in resource. It doesn’t get applied. It just appears like regular text.

This is the resource.

<string name="quantity"><b>QNTY :</b></string>

This how it is applied to the textView.

android:text="@{inventory.quantity+@string/quantity}"

After some googling i found out that if you use tags like <b> in your string resource, make sure you retrieve it using getText(R.string.whatever) rather than getString(R.string.whatever). Because getString(R.string.whatever) doesn’t retain the rich text formatting. So is DataBinding under the hood using getString()???