I am developing an application where I have to use numerous toasts.
I display these toasts by using:
Toast.makeText(context, \"Some medium-sized text\",
Try inserting a carriage-return and line-feed where you want to split the text.
These characters refer back to the old typewriter models. Carriage return was the cylinder moving back to the start and line feed was the cylinder rolling (feeding) by one line.
In computing these are represented by two escaped characters (special codes that allow non-printable codes inside a string by prefixing them with a backslash \
).
\r
\n
(you can remember this as a new line).Some non-unix systems (e.g. Windows) require both, others (e.g Linux on which Android is based) only need the new line but it is generally safe to do both everywhere. The one thing that is essential is the order they are in. It must be \r\n
To put this into your example:
Toast.makeText(context, "First line of text\r\nSecond line of text", Toast.LENGTH_SHORT).show();
In Android you should be able to reduce this to just the new line character \n
as unix based systems are not so fussy:
Toast.makeText(context, "First line of text\nSecond line of text", Toast.LENGTH_SHORT).show();