I need to display multiple lines of messages, rather than just one paragraph, in an alert dialogue.
new AlertDialog.Builder(this)
.setTitle("Place")
.setMessage("Go there" +
"Go here")
.setNeutralButton("Go Back", null)
.show();
Is there a way to start at new lines? Just like hitting enter after a sentence in Microsoft Word?
Use the "\n" tag in your strings:
Have you tried a carriage return or line feed character? These are characters 10 and 13 respectively (special characters \n and \r, or \u000a and \u000d)
I think the best solution is to avoid break line and use a custom view component.
With this solution you can break the line if you want using
\n
, but if you don't, the text will be wrapped on multiple lines (since I settw.setSingleLine(false);
).No guarantees on this, but usually to do multiple lines you do something like:
The "\n" is an escape character that means "New Line" I don't know about your specific case, but you can use it in just about everything AFAIK.