This is strange. I have a text in my string file which has
<sup>\u00AE</sup>
in it. If I set this text to my TextView in xml file. It looks fine. But when I'm updating the it in the run time its not setting and displays like a normal letter.
.xml:
android:text="@string/you_dont_have_a_card"
android:id="@+id/txtNoCard"
.java
txtNoCard.setText(Html.fromHtml(getString(R.string.your_card_is_not_activated)));
strings.xml:
<string name="you_dont_have_a_card">It appears you do not have a TestVisa<sup>\u00AE</sup> Debit Card on file.</string>
In XML, < and > are special characters. When including them, to avoid having the parser read them as enclosing tags, they have to be described as Entities.
In this case :
<sup>\u00AE</sup>
The surprising thing in this case is the behavior of the TextView when the text is added directly as android:text="@string/you_dont_have_a_card", which apparently uses a parser with a different behavior when facing special characters.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With