Setting a new line without a network call works for me:
mTextView.setText("Message 1 \nMessage 2");
However when I set the text from the JSON in an API call it doesn't work for me:
mTextView.setText(userInfo.getDescription());
The format it's stored in my db is: hello \nTest message.
What is the issue?
Edit:
Tried doing this, but doesn't work either
Log.d(TAG, "formatDescription: Description: " + description);
String x = description.replace("\n", System.lineSeparator());
Log.d(TAG, "formatDescription: Formatted: " + x);
return x;
Edit 2:
Need to add an extra "\"
to .replace("\n", System.lineSeparator());
for it to work
String description = userInfo.getDescription();
description = description.replace("\\n", System.lineSeparator());
System.out.println(description);
mTextView.setText(description);