Search code examples
androidstringenter

How to insert a new line in strings in Android


I'm creating an android application and within it there is a button that will send some information in an email, and I don't want to have everything all in one paragraph.

Here's what my app is doing for the putExtra for the email's body:

I am the first part of the info being emailed. I am the second part. I am the third part.

Here's what I want it to do:

I am the first part of the info being emailed.
I am the second part.

I am the third part.

How would I put a new line into a string or with the putExtra method to accomplish that?


Solution

  • Try using System.getProperty("line.separator") to get a new line.