I receive a text with linebreaks from an API but I can't get the linebreaks to work.
This is a part of the text I want to shown. http://pastebin.com/CLnq16mP (pasted it there because the formatting on stackoverflow wasnt correct.)
I tried this:
termsAndConditionsTextView.setText(Html.fromHtml("<html><body>" + textResponse.getText() + "</body></html>"));
and this:
termsAndConditionsTextView.setText(Html.fromHtml(textResponse.getText()));
but the linebreaks (\r\n) and spaces are always ignored.
How can I fix this?
Since its html try using
</br>
You can replace all \r\n and spaces in your text by doing something like this:
//message is your string.
message = message.replace("\r\n","<br />");
message = message.replace(" "," ");
termsAndConditionsTextView.setText(Html.fromHtml(message));
Good Luck!