Skip to main content
removed slightly false statement
Source Link
Michael K
  • 2.9k
  • 1
  • 22
  • 24

This should work:

String aboutText = getText(R.string.about_text).toString();

aboutText = aboutText.replace("\n ", "\n");

Keep in mind that the CharSequence interface is kind of a String in disguise - toString() is there to convert to a String object. Since String implements CharSequence, the result of the replace() may be passed to any method requiring a CharSequence.

This should work:

String aboutText = getText(R.string.about_text).toString();

aboutText = aboutText.replace("\n ", "\n");

Keep in mind that the CharSequence interface is kind of a String in disguise - toString() is there to convert to a String object. Since String implements CharSequence, the result of the replace() may be passed to any method requiring a CharSequence.

This should work:

String aboutText = getText(R.string.about_text).toString();

aboutText = aboutText.replace("\n ", "\n");

toString() is there to convert to a String object.

Source Link
Michael K
  • 2.9k
  • 1
  • 22
  • 24

This should work:

String aboutText = getText(R.string.about_text).toString();

aboutText = aboutText.replace("\n ", "\n");

Keep in mind that the CharSequence interface is kind of a String in disguise - toString() is there to convert to a String object. Since String implements CharSequence, the result of the replace() may be passed to any method requiring a CharSequence.