Skip to content Skip to sidebar Skip to footer

Changing A Marker's Text In Android Googlemaps

Is it possible to change the text inside a GoogleMap Marker after it's already been set? I'm using MarkerOptions to set the title and snippet originally like this: SupportMapFragm

Solution 1:

Is it possible to change the text inside a GoogleMap Marker after it's already been set?

Marker has setTitle() and setSnippet() methods. You will need a Marker object representing this marker, probably one that you held onto from the addMarker() call.

Solution 2:

Try this:

@OverridepublicbooleanonMarkerClick(final Marker marker) {

    if (marker.equals(myMarker)) 
    {
         googleMap.addMarker(newMarkerOptions()
                .position(marker.getPosition())
                .title("Onother title")
                .snippet("snippet")
                .icon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_AZURE)));
    }
}

Post a Comment for "Changing A Marker's Text In Android Googlemaps"