Marker position change event

I am using the new Google Maps for Android v2. Is there a way to set a listener to change the position of the marker? For example, when the user drags a marker.

+3


source to share


1 answer


Quote documentation :

You can use the OnMarkerDragListener to listen for drag events on the marker. To set this listener on the map, call GoogleMap.setOnMarkerDragListener. To drag a marker, the user must long press on the marker. When the user removes their finger from the screen, the marker will remain in that position. When a marker is being dragged, onMarkerDragStart (Marker) is called first. While the marker is being dragged, onMarkerDrag (Marker) is called continuously. At the end, the drag is called onMarkerDragEnd (Marker). You can get the position of the marker at any time by calling Marker.getPosition ().



Here is a sample project demonstrating the use of OnMarkerDragListener

.

+10


source







All Articles