0

I have a string resource in xml

<string name="contoh">&#xf080;</string>

and then I call from java

String res = getString(R.string.contoh);
String langsung = "&#xf080;";

after I display the output is different, like this image

enter image description here

please help, how to convert that string from java to become like string from xml, because I want to display icon from API using that code Thank you

SOLVED in this, in accepted answer,

Unicode characters not displayed in TextView.setText

yourTextView.setText(Html.fromHtml("&#xf080;"));
Fahriyal Afif
  • 560
  • 3
  • 11

1 Answers1

0

You need to parse color with:

String langsung = "&#xf080;";
Color myColor = Color.parseColor(langsung)
janavarro
  • 869
  • 5
  • 24
  • Hi Jose, this is not color, this is a word or text usual, i need to display icon from this library https://github.com/ravi8x/Android-Font-Awesome, but in the example it display icon from string xml resource, i need to display from string java – Fahriyal Afif Mar 11 '20 at 09:22
  • 1
    Oh, now I understand you. It is such a weird thing what you want to do, and I think it is impossible. Strings in XML are added to the project at compile time, not runtime. – janavarro Mar 11 '20 at 09:24