1

I'm creating a weather application using an api and from the json object I'm getting

{"success":true,"temp":"14","picto":"meteo_32","icon":"\uf00d;","unite":"C","frequence":"4"}

I used for the font of the picture :

https://erikflowers.github.io/weather-icons/

So I added the strings to the directory of the project in android studio and this is my code :

JSONObject jObj = new JSONObject(responseContent);
String icon = String.valueOf(jObj.get("icon"));
weatherFont = Typeface.createFromAsset(getAssets(),"fonts/weathericons_regular_webfont.ttf");
imageMTO.setTypeface(
icon = icon.replace("\\u", "&#x");
imageMTO.setText(icon);

But I'm getting &#xuf00d; on the textView when I run the app

Can any one help me ?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115

2 Answers2

0
icon = icon.replace("\\u", "&#x");

this line make you a problem

Actually it should work fine with \uf00d Use .replace(";", "");

Olena Y
  • 233
  • 2
  • 8
0

am not really 100 percent sure but i think it is because in your json object icon is uf00d

Ayodele Kayode
  • 304
  • 4
  • 20