Reputation: 91
In my android project, i need to display a text with a TextView, but i got a very suck issues with the following string. Someone help me, please.
Here is my java string :
TRAI floats new paper on \\u0027Net Neutrality\\u0027: Lists disadvantages of zero-rating plans
It's display like this in my TextView:
TRAI floats new paper on \u0027Net Neutrality\u0027: Lists disadvantages of zero-rating plans
I want it to show like this:
TRAI floats new paper on 'Net Neutrality': Lists disadvantages of zero-rating plans"
What should i do ? Thanks in advance!
Update :
I have already tried with this code, but don't work for me.
title.setText(Html.fromHtml(news.getTitle()).toString())
And i want a solution for all '\uxxxx' like chars, not the '\u0027' only.
Upvotes: 3
Views: 4037
Reputation: 159250
Don't double the backslahes:
String s = "TRAI floats new paper on \u0027Net Neutrality\u0027: Lists disadvantages of zero-rating plans";
This will have the value:
TRAI floats new paper on 'Net Neutrality': Lists disadvantages of zero-rating plans
Upvotes: 4
Reputation: 302
try this one
str = org.apache.commons.lang.StringEscapeUtils.unescapeJava(str);
refer Apache commons lang
Upvotes: 3