Hi I have an response from backend API with HTML string format, and I put into textview as HTML in android using:
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
sinopsis.setText(Html.fromHtml(summaryText, Html.FROM_HTML_MODE_COMPACT));
}else{
sinopsis.setText(Html.fromHtml(summaryText));
}
The problem is:
If I put response from API direct into Textview the result is correct show as HTML parsed like <br/>,
tags not shown as html code
Hi this is example from API response
Thanks
but if I save the result into SQLite as string and get in to Textview shown as pure html code
Hi this is example from API response <br />Thanks
solved: I translated some html into string function in Android like
into \\n
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.