I'm new in Android.
When using Json Parsing, I have a problem with display text(maybe cause by font, I don't know).
This is my Json return:
{"Response":[{"Id":829,"Name":"Tiền không đem lại hạnh phúc nhưng...","ShortDescription":"Một tỷ phú tâm sự với bạn,...
But when I parse in TextView in android, the "Name" become:
"Ti�n không đem lại hạnh phúc nhưng..."
This text is in Vietnamese. How can I fix it?
Go to File -> Settings, a new setting dialogue box will appear. Then go to Editor -> General. Now mark the checkbox Change font size with Ctrl + Mouse wheel and click on Apply button. Now to change your editor font size, you just have to press and hold Ctrl and rotate the Mouse wheel.
Change Text Style of TextView to BOLD in XML Layout File textStyle attribute of TextView widget accepts on of these values: "bold" , "italic" or "normal" . To change the style to bold, you have to assign textStyle with "bold" .
I fixed it. My problem is UTF-8 charset.
String name = "";
try {
name = new String(c.getString("NAME").getBytes("ISO-8859-1"), "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
String decodedName = Html.fromHtml(name).toString();
Use a webView to display text like this:
myWebView.loadData(myHtmlString, "text/html; charset=UTF-8", null);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With