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:
Let's discuss these events in detail.
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 ...