I have been able to use html tags in the string ie, to set textview from resource like :
<resources>
<string name="somestring">
<B>Title</B> <I>Italic</I><BR/>
Content
</string>
</resources>
This works fine when the text is in resource and I set it to my textView.
Now, I want to programmatically set a string I get from server at runtime to the textView. Therefore I can't define the string in resource folder.
I tried the following
textView.setText("<B>Bold</B><I>Italic</I>");
but this doesnt work. Any help would be appreciated.
Use code like:
textview.setText(Html.fromHtml("YOUR HTML STRING"));
Hope it will help you.
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