purpule
purpule

Reputation: 116

Java: Newline in strings.xml does not work

i am trying to print a new line in a text view. i am using a string <string name="newl">\n</string> in my strings.xml file.

i want to use the new line in a output.setText(new StringBuilder().append(output.getText()).append(R.string.newl2).append(input.getText())); but instead of a new line it says "2131099673"

I am using android studio and i am debugging on a xperia z2

Upvotes: 0

Views: 360

Answers (1)

petey
petey

Reputation: 17140

try this

output.setText(new StringBuilder().append(output.getText()).append(output.getResources().getString(R.string.newl2)).append(input.getText()));

Upvotes: 3

Related Questions