This may seem like a stupid question, but I've been searching and can't find an answer.
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?
Thank you.
Add Line Breaks to a TextView Just add a \n to your text. This can be done directly in your layout file, or in a string resource and will cleanly break the text in your TextView to the next line.
In Windows, a new line is denoted using “\r\n”, sometimes called a Carriage Return and Line Feed, or CRLF. Adding a new line in Java is as simple as including “\n” , “\r”, or “\r\n” at the end of our string.
If you want to show a strike-through text you can do it programming using PaintFlags. You can set paint flags Paint. STRIKE_THRU_TEXT_FLAG to a TextView and it will add a strike-through to the text. TextView textView = (TextView) findViewById(R.
in a string prevents actually making a new line and instead of Type (new line) for a new line it is Type \n for a new line .
Try:
String str = "my string \n my other string";
When printed you will get:
my string
my other string
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With