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

Working with map events

The Google Map's API allows us to listen for events on a map similar to those that we listen to on buttons and other views. The events that are available for this purpose are:

  • Map click / long click events
  • Camera change events
  • Indoor map events

Let's discuss these events in detail.

Map click/long click events

To handle map click events, we should use the OnMapClickListener interface on the GoogleMap object. To enable this, call the setOnMapClickListener() method on the GoogleMap object, which takes the GoogleMap.OnMapClickListener() interface as a parameter. When you click anywhere on a map, the onMapClick() method is called. In this example, we shall display a toast that shows the latitude and longitude of the location that ...

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