I want to remove HTML and show bullet instead of <li> in Android
method to remove html :
public static String removeHTML(String value){
value = value.replace("<ul style=\"list-style-type: disc;\">" , "<ul>");
value = value.replace("<ul>" , "");
value = value.replace("</ul>" , "");
value = value.replace("<li>" , " • "); // Bullet
value = value.replace("</li>" , "");
value = value.replace("<p>" , "");
value = value.replace("</p>" , "<br />");
value = value.replace("<br />" , " \n ");
return Html.fromHtml(value).toString();
}
content is :
title goes here
<ul style=\"list-style-type: disc;\">
<li>line one</li>
<li>line two</li>
<li>line three</li>
<li>line four</li>
</ul>
but when i print system logs is shows :
title goes here
•
line one
•
line two
•
line three
•
line four
I am pretty sure that your string is having \\n
character before and after bullets. remove all \\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.