简体   繁体   中英

Display parsed HTML content in a TextView

I want to display some HTML content in a TextView. The content is dynamically parsed using JSON parsing. Given below is extracted from the JSON response I got, when I tried the link in browser.

<p><font color='#FF0000'><strong>MESSAGE BLOCKED.</strong></font><br />nThank you.</p>

But when I finished parsing in phone,the html tags looked like:

"& lt;","p &gt" etc

I have no idea why this is happening. Please Help. Thanks in advance

res is the String(From Server)

 Spanned sp = Html.fromHtml(res.replace("&lt;", "<").replace("&gt;", ">"));
 textview.setText(sp);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM