Heu guys i have an app where i'm parsing an html file using jsoup to display selected texts in a listview in android. However i cant seem to find a way to keep the carriage returns.
Here is what i have attempted :
Elements br = doc.select("br");
for (Element src : br) {
src.append("\n");
}
To give you an example with a string
<div
This is a string <br> another string
/>
Is parsed and displays :
This is a string another string
I have tried using
src.append("\\n");
Which displays
This is a string \n another string
I am using an arraylist of strings to store these variables.
Ive been trying to find a solution to this problem with no luck i have attempted solutions from the following threads:
How do I preserve line breaks when using jsoup to convert html to plain text?
Removing HTML entities while preserving line breaks with JSoup