Atmaram Atmaram - 1 year ago 74
Android Question

How to set Font Icon as String

I am trying to load font icon using fontawesome.ttf in a textView.
If i set the string value like

through string.xml then it works file and Icon is shown. But if the same text
is set programatically as

then it doesn't show the icon , rather the same text is shown on textview.

Any alternative approach to show icons programatically without referring string.xml file ?

Answer Source

I tried converting the string with base 16 integer and it worked fine.

new String(Character.toChars(Integer.parseInt(
                        str, 16)))

str has the unicode value like f007.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download