简体   繁体   中英

Android: String from SQLite can not be set as HTML in Textview

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/>, &nbsp; 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

在此处输入图片说明 I no idea to solve this case, anyone can help me please.

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.

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