I am using the OSMbonuspack to create markers and want to add a description with separate lines. However, a normal new line character (\n
) does not work. So I am wondering if it is even possible to do this. But it seems to be such a common thing, so I would expect, that there is a possibility to do so. I tried the following code, but the newline character has no effect:
Marker playgroundMarker = new Marker(mapView);
playgroundMarker.setPosition(new GeoPoint(latitude, longitude));
playgroundMarker.setTitle(title);
playgroundMarker.setSubDescription("first line\nsecond line");
This results in the following description: first line second line
instead of:
first line
second line
At the moment my only solution is to use separate the description in two. Using the first part as a snippet (playgroundMarker.setSnippet(...)
) and the second part as a description (playgroundMarker.setSubDescription(...)
). But there should be a better way.
Any ideas?
Both snippet and subdescription support html tags. So this will do the job:
playgroundMarker.setSubDescription("first line<br>second line");