miannelle2 miannelle2 - 6 months ago 51
Android Question

android embed newline in a notification

I need to embed a newline in a notification. I have two lines of data that are different and I need to embed a newline to distinguish between the two.
I trued a backslash-n, but that does not work.

Is there a way to do this?


As far as I know there is no way to do this other than creating a custom Notification layout. The Notification documentation has a step-by-step process on doing this and is quite thorough. Here is the link to that.

Creating the two lines as you require would just mean putting in an extra TextView in the layout XML. Then you would just set each TextView's text to your two lines of data, as the example shows.