3

I have this code that shows info on a GoogleMap in Android, and I want to show a snippet with multiple lines. I tried using "\n" but that doesn't work.

An example of how I want the snippet text formatted:

United University
Faculty of Science
Code: 2011A-5AT

Here is my current code, please help !

 map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map))
                            .getMap();
                        Marker hamburg = map.addMarker(new MarkerOptions().position(HAMBURG).icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_RED))
                                .snippet("United University")
                                .title("Student Peter"));
                        map.moveCamera(CameraUpdateFactory.newLatLngZoom(HAMBURG, 15));
                        map.animateCamera(CameraUpdateFactory.zoomTo(18), 2000, null);  
stkent
  • 19,772
  • 14
  • 85
  • 111
Van Joseph
  • 59
  • 2
  • 5
  • Have you tried using html? eg: `Html.fromHtml("United
    University")`
    – myanimal Jan 31 '15 at 17:30
  • I'm try to implement your code like this, ... .snippet(Html.fromHtml("United
    University")) ... it shows this error: The method snippet(String) in the type MarkerOptions is not applicable for the arguments (Spanned)
    – Van Joseph Jan 31 '15 at 17:37
  • Ah, I thought snippet() might take `CharSequence`. Looks like you will have to create a custom layout and `InfoWindow`. See https://developers.google.com/maps/documentation/android/infowindows and http://stackoverflow.com/questions/13904651/android-google-maps-v2-how-to-add-marker-with-multiline-snippet – myanimal Jan 31 '15 at 17:43
  • @myanimal i used it like this, but it shows all info in one line , however i want to show each info in new line – Van Joseph Feb 01 '15 at 16:19

0 Answers0