Skip to content Skip to sidebar Skip to footer

Android, Format Text From Json To Html Removes New Lines And White Spaces

The text is received from a Json is like this: This is sentence 1. This is sentence 2. And I use this code to format to HTML and pass it to a textView: p

Solution 1:

The only solution that seems reasonable, for now, is to replace the required characters with HTML tags, in the json string in java:

jsonText.replace("\r\n", "<br/>");

But if any of you have a more elegant/simple solution, feel free to post it!

Post a Comment for "Android, Format Text From Json To Html Removes New Lines And White Spaces"