1

I want to put a Font-Awesome icon inside textview text. After I set the text, android shows me a string sequence instead of font-icon.

My code is:

String formatedSection = formatedSection + sections.get(i).getContent() +getResources().getString(R.string.icon_ref);

I define icon_ref in string.xml as below:

 <string name="icon_ref">&#xf075;</string>

I followed these instructions to add font-icon. What am I doing wrong?

Community
  • 1
  • 1
MSepehr
  • 890
  • 2
  • 13
  • 36

1 Answers1

1

If you did step 5 in that short guid your problem seem to forget that there is a diff between java and XML.

In XML you use XML escape (&...;), in Java you'll probably have to use Java escape (\u...). – Biffen May 20 at 10:10

Try to hard code the string into "\uf075" and it would work like a charm.

Remy
  • 1,053
  • 1
  • 19
  • 25