GoogleMap.OnMarkerDragListener
Stay organized with collections
Save and categorize content based on your preferences.
Callback interface for drag events on markers.
Listeners will be invoked on the Android UI thread.
Public Method Summary
abstract void |
|
abstract void |
|
abstract void |
|
Public Methods
public abstract void onMarkerDrag (Marker
marker)
Called repeatedly while a marker is being dragged. The marker's location can be
accessed via Marker.getPosition()
.
Parameters
marker |
The marker being dragged. |
public abstract void onMarkerDragEnd (Marker
marker)
Called when a marker has finished being dragged. The marker's location can be
accessed via Marker.getPosition()
.
Parameters
marker |
The marker that was dragged. |
public abstract void onMarkerDragStart (Marker
marker)
Called when a marker starts being dragged. The marker's location can be accessed via
Marker.getPosition()
;
this position may be different to the position prior to the start of the drag because
the marker is popped up above the touch point.
Parameters
marker |
The marker being dragged. |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eGoogleMap.OnMarkerDragListener\u003c/code\u003e is an interface used to handle drag events on markers displayed on a Google Map.\u003c/p\u003e\n"],["\u003cp\u003eIt provides three callback methods: \u003ccode\u003eonMarkerDragStart\u003c/code\u003e, \u003ccode\u003eonMarkerDrag\u003c/code\u003e, and \u003ccode\u003eonMarkerDragEnd\u003c/code\u003e, which are triggered when a marker's drag starts, continues, and ends respectively.\u003c/p\u003e\n"],["\u003cp\u003eAll callback methods receive the dragged \u003ccode\u003eMarker\u003c/code\u003e object as a parameter, allowing you to access its location and other properties during the drag interaction.\u003c/p\u003e\n"],["\u003cp\u003eThese listeners are invoked on the Android UI thread, ensuring that any UI updates related to marker dragging are performed safely.\u003c/p\u003e\n"]]],["The `GoogleMap.OnMarkerDragListener` interface provides callbacks for marker drag events on Google Maps. It features three methods: `onMarkerDragStart`, invoked when a marker starts being dragged; `onMarkerDrag`, triggered repeatedly during the drag; and `onMarkerDragEnd`, called when the drag finishes. Each method receives the `Marker` object as a parameter, allowing access to the marker's position via `Marker.getPosition()`. All actions happens on the android UI thread.\n"],null,["# GoogleMap.OnMarkerDragListener\n\npublic static interface **GoogleMap.OnMarkerDragListener** \nCallback interface for drag events on markers.\n\nListeners will be invoked on the Android UI thread. \n\n### Public Method Summary\n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [onMarkerDrag](/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerDragListener#onMarkerDrag(com.google.android.gms.maps.model.Marker))([Marker](/android/reference/com/google/android/gms/maps/model/Marker) marker) Called repeatedly while a marker is being dragged. |\n| abstract void | [onMarkerDragEnd](/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerDragListener#onMarkerDragEnd(com.google.android.gms.maps.model.Marker))([Marker](/android/reference/com/google/android/gms/maps/model/Marker) marker) Called when a marker has finished being dragged. |\n| abstract void | [onMarkerDragStart](/android/reference/com/google/android/gms/maps/GoogleMap.OnMarkerDragListener#onMarkerDragStart(com.google.android.gms.maps.model.Marker))([Marker](/android/reference/com/google/android/gms/maps/model/Marker) marker) Called when a marker starts being dragged. |\n\nPublic Methods\n--------------\n\n#### public abstract void **onMarkerDrag** ([Marker](/android/reference/com/google/android/gms/maps/model/Marker) marker)\n\nCalled repeatedly while a marker is being dragged. The marker's location can be\naccessed via [Marker.getPosition()](/android/reference/com/google/android/gms/maps/model/Marker#getPosition()). \n\n##### Parameters\n\n| marker | The marker being dragged. |\n|--------|---------------------------|\n\n#### public abstract void **onMarkerDragEnd** ([Marker](/android/reference/com/google/android/gms/maps/model/Marker) marker)\n\nCalled when a marker has finished being dragged. The marker's location can be\naccessed via [Marker.getPosition()](/android/reference/com/google/android/gms/maps/model/Marker#getPosition()). \n\n##### Parameters\n\n| marker | The marker that was dragged. |\n|--------|------------------------------|\n\n#### public abstract void **onMarkerDragStart** ([Marker](/android/reference/com/google/android/gms/maps/model/Marker) marker)\n\nCalled when a marker starts being dragged. The marker's location can be accessed via\n[Marker.getPosition()](/android/reference/com/google/android/gms/maps/model/Marker#getPosition());\nthis position may be different to the position prior to the start of the drag because\nthe marker is popped up above the touch point. \n\n##### Parameters\n\n| marker | The marker being dragged. |\n|--------|---------------------------|"]]