O'Reilly logo

Learning Android Google Maps by Raj Amal W.

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Adding information with markers

Markers can be used to indicate a particular location on a map. A marker can be customized by changing its color or using a custom image instead of a marker icon. This image is an example of a marker:

Adding information with markers

How to add a marker?

We need to use a Marker object to work with markers. A new marker can be added with the following method:

GoogleMap.addMarker()

This code takes the parameter as the MarkerOptions object. The latitude and longitude are set for the map using a LatLng object. The latitude and longitude can also be set as follows

MarkerOptions().position()

This method takes the LatLng object as a parameter. Now, let's create ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required