Atmaram Atmaram - 16 days ago 6
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
textView.setText("")

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

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.

Comments