public class MapboxMap
extends java.lang.Object
MapboxMap object directly, rather,
you must obtain one from the getMapAsync() method on a MapFragment or MapView that you have
added to your application.
Note: Similar to a View object, a MapboxMap should only be read and modified from the main thread.
| Modifier and Type | Class and Description |
|---|---|
static interface |
MapboxMap.CancelableCallback
Interface definition for a callback to be invoked when a task is complete or cancelled.
|
static interface |
MapboxMap.InfoWindowAdapter
Interface definition for a callback to be invoked when an info window will be shown.
|
static class |
MapboxMap.MarkerViewAdapter<U extends MarkerView>
Interface definition for a callback to be invoked when an MarkerView will be shown.
|
static interface |
MapboxMap.OnCameraChangeListener
Interface definition for a callback to be invoked when the camera changes position.
|
static interface |
MapboxMap.OnFlingListener
Interface definition for a callback to be invoked when the map is flinged.
|
static interface |
MapboxMap.OnFpsChangedListener
Interface definition for a callback to be invoked when a frame is rendered to the map view.
|
static interface |
MapboxMap.OnInfoWindowClickListener
Interface definition for a callback to be invoked when the user clicks on an info window.
|
static interface |
MapboxMap.OnInfoWindowCloseListener
Interface definition for a callback to be invoked when a marker's info window is closed.
|
static interface |
MapboxMap.OnInfoWindowLongClickListener
Interface definition for a callback to be invoked when the user long presses on a marker's info window.
|
static interface |
MapboxMap.OnMapClickListener
Interface definition for a callback to be invoked when the user clicks on the map view.
|
static interface |
MapboxMap.OnMapLongClickListener
Interface definition for a callback to be invoked when the user long clicks on the map view.
|
static interface |
MapboxMap.OnMarkerClickListener
Interface definition for a callback to be invoked when the user clicks on a marker.
|
static interface |
MapboxMap.OnMarkerViewClickListener
Interface definition for a callback to be invoked when the user clicks on a MarkerView.
|
static interface |
MapboxMap.OnMyBearingTrackingModeChangeListener
Interface definition for a callback to be invoked when the the My Location tracking mode changes.
|
static interface |
MapboxMap.OnMyLocationChangeListener
Interface definition for a callback to be invoked when the the My Location view changes location.
|
static interface |
MapboxMap.OnMyLocationTrackingModeChangeListener
Interface definition for a callback to be invoked when the the My Location tracking mode changes.
|
static interface |
MapboxMap.OnScrollListener
Interface definition for a callback to be invoked when the map is scrolled.
|
static interface |
MapboxMap.SnapshotReadyCallback
Interface definition for a callback to be invoked when the snapshot has been taken.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addCustomLayer(CustomLayer customLayer,
java.lang.String before)
Do not use this method, experimental feature.
|
Marker |
addMarker(BaseMarkerOptions markerOptions)
Adds a marker to this map.
|
MarkerView |
addMarker(BaseMarkerViewOptions markerOptions)
Adds a marker to this map.
|
Marker |
addMarker(MarkerOptions markerOptions)
Adds a marker to this map.
|
java.util.List<Marker> |
addMarkers(java.util.List<? extends BaseMarkerOptions> markerOptionsList)
Adds multiple markers to this map.
|
Polygon |
addPolygon(PolygonOptions polygonOptions)
Adds a polygon to this map.
|
java.util.List<Polygon> |
addPolygons(java.util.List<PolygonOptions> polygonOptionsList)
Adds multiple polygons to this map.
|
Polyline |
addPolyline(PolylineOptions polylineOptions)
Adds a polyline to this map.
|
java.util.List<Polyline> |
addPolylines(java.util.List<PolylineOptions> polylineOptionsList)
Adds multiple polylines to this map.
|
void |
animateCamera(CameraUpdate update)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
animateCamera(CameraUpdate update,
int durationMs)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
animateCamera(CameraUpdate update,
int durationMs,
MapboxMap.CancelableCallback callback)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
animateCamera(CameraUpdate update,
MapboxMap.CancelableCallback callback)
Animate the camera to a new location defined within
CameraUpdate using a transition
animation that evokes powered flight. |
void |
clear()
Removes all markers, polylines, polygons, overlays, etc from the map.
|
void |
cycleDebugOptions()
Cycles through the map debug options.
|
void |
deselectMarker(Marker marker)
Deselects a currently selected marker.
|
void |
deselectMarkers()
Deselects any currently selected marker.
|
void |
easeCamera(CameraUpdate update)
Gradually move the camera by the default duration, zoom will not be affected unless specified
within
CameraUpdate. |
void |
easeCamera(CameraUpdate update,
int durationMs)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate. |
void |
easeCamera(CameraUpdate update,
int durationMs,
boolean easingInterpolator) |
void |
easeCamera(CameraUpdate update,
int durationMs,
boolean easingInterpolator,
MapboxMap.CancelableCallback callback) |
void |
easeCamera(CameraUpdate update,
int durationMs,
MapboxMap.CancelableCallback callback)
Gradually move the camera by a specified duration in milliseconds, zoom will not be affected
unless specified within
CameraUpdate. |
java.lang.String |
getAccessToken()
Deprecated.
As of release 4.1.0, replaced by
MapboxAccountManager.getAccessToken() |
Annotation |
getAnnotation(long id)
Return a annotation based on its id.
|
java.util.List<Annotation> |
getAnnotations()
Returns a list of all the annotations on the map.
|
CameraPosition |
getCameraPosition()
Gets the current position of the camera.
|
MapboxMap.InfoWindowAdapter |
getInfoWindowAdapter()
Gets the callback to be invoked when an info window will be shown.
|
java.util.List<Marker> |
getMarkers()
Returns a list of all the markers on the map.
|
MarkerViewManager |
getMarkerViewManager()
Get the MarkerViewManager associated to the MapView.
|
double |
getMaxZoom()
Gets the maximum zoom level the map can be displayed at.
|
double |
getMinZoom()
Gets the maximum zoom level the map can be displayed at.
|
android.location.Location |
getMyLocation()
Returns the currently displayed user location, or null if there is no location data available.
|
MyLocationViewSettings |
getMyLocationViewSettings()
Gets the settings of the user location for the map.
|
MapboxMap.OnInfoWindowClickListener |
getOnInfoWindowClickListener()
Return the InfoWindow click listener
|
MapboxMap.OnInfoWindowCloseListener |
getOnInfoWindowCloseListener()
Return the InfoWindow close listener
|
MapboxMap.OnInfoWindowLongClickListener |
getOnInfoWindowLongClickListener()
Return the InfoWindow long click listener
|
int[] |
getPadding()
Returns the current configured content padding on map view.
|
java.util.List<Polygon> |
getPolygons()
Returns a list of all the polygons on the map.
|
java.util.List<Polyline> |
getPolylines()
Returns a list of all the polylines on the map.
|
Projection |
getProjection()
Get the Projection object that you can use to convert between screen coordinates and latitude/longitude coordinates.
|
java.util.List<Marker> |
getSelectedMarkers()
Gets the currently selected marker.
|
java.lang.String |
getStyleUrl()
Returns the map style currently displayed in the map view.
|
TrackingSettings |
getTrackingSettings()
Gets the tracking interface settings for the map.
|
UiSettings |
getUiSettings()
Gets the user interface settings for the map.
|
void |
invalidate()
Triggers an invalidation of the map view.
|
void |
invalidateCustomLayers()
Do not use this method, experimental feature.
|
boolean |
isAllowConcurrentMultipleOpenInfoWindows()
Returns whether the map allows concurrent multiple infowindows to be shown.
|
boolean |
isDebugActive()
Returns whether the map debug information is currently shown.
|
boolean |
isMyLocationEnabled()
Returns the status of the my-location layer.
|
void |
moveCamera(CameraUpdate update)
Repositions the camera according to the instructions defined in the update.
|
void |
moveCamera(CameraUpdate update,
MapboxMap.CancelableCallback callback)
Repositions the camera according to the instructions defined in the update.
|
void |
removeAnnotation(Annotation annotation)
Removes an annotation from the map.
|
void |
removeAnnotation(long id)
Removes an annotation from the map
|
void |
removeAnnotations()
Removes all annotations from the map.
|
void |
removeAnnotations(java.util.List<? extends Annotation> annotationList)
Removes multiple annotations from the map.
|
void |
removeCustomLayer(java.lang.String id)
Do not use this method, experimental feature.
|
void |
removeMarker(Marker marker)
Convenience method for removing a Marker from the map.
|
void |
removePolygon(Polygon polygon)
Convenience method for removing a Polygon from the map.
|
void |
removePolyline(Polyline polyline)
Convenience method for removing a Polyline from the map.
|
void |
resetNorth()
Resets the map view to face north.
|
void |
selectMarker(Marker marker)
Selects a marker.
|
void |
setAccessToken(java.lang.String accessToken)
Deprecated.
As of release 4.1.0, replaced by
MapboxAccountManager.start(Context, String) |
void |
setAllowConcurrentMultipleOpenInfoWindows(boolean allow)
Changes whether the map allows concurrent multiple infowindows to be shown.
|
void |
setCameraPosition(CameraPosition cameraPosition)
Repositions the camera according to the cameraPosition.
|
void |
setDebugActive(boolean debugActive)
Changes whether the map debug information is shown.
|
void |
setInfoWindowAdapter(MapboxMap.InfoWindowAdapter infoWindowAdapter)
Sets a custom renderer for the contents of info window.
|
void |
setMaxZoom(double maxZoom)
Sets the maximum zoom level the map can be displayed at.
|
void |
setMinZoom(double minZoom)
Sets the minimum zoom level the map can be displayed at.
|
void |
setMyLocationEnabled(boolean enabled)
Enables or disables the my-location layer.
|
void |
setOnCameraChangeListener(MapboxMap.OnCameraChangeListener listener)
Sets a callback that's invoked on every change in camera position.
|
void |
setOnFlingListener(MapboxMap.OnFlingListener listener)
Sets a callback that's invoked when the map is flinged.
|
void |
setOnFpsChangedListener(MapboxMap.OnFpsChangedListener listener)
Sets a callback that's invoked on every frame rendered to the map view.
|
void |
setOnInfoWindowClickListener(MapboxMap.OnInfoWindowClickListener listener)
Sets a callback that's invoked when the user clicks on an info window.
|
void |
setOnInfoWindowCloseListener(MapboxMap.OnInfoWindowCloseListener listener) |
void |
setOnInfoWindowLongClickListener(MapboxMap.OnInfoWindowLongClickListener listener)
Sets a callback that's invoked when a marker's info window is long pressed.
|
void |
setOnMapClickListener(MapboxMap.OnMapClickListener listener)
Sets a callback that's invoked when the user clicks on the map view.
|
void |
setOnMapLongClickListener(MapboxMap.OnMapLongClickListener listener)
Sets a callback that's invoked when the user long clicks on the map view.
|
void |
setOnMarkerClickListener(MapboxMap.OnMarkerClickListener listener)
Sets a callback that's invoked when the user clicks on a marker.
|
void |
setOnMyBearingTrackingModeChangeListener(MapboxMap.OnMyBearingTrackingModeChangeListener listener)
Sets a callback that's invoked when the bearing tracking mode changes.
|
void |
setOnMyLocationChangeListener(MapboxMap.OnMyLocationChangeListener listener)
Sets a callback that's invoked when the the My Location view
(which signifies the user's location) changes location.
|
void |
setOnMyLocationTrackingModeChangeListener(MapboxMap.OnMyLocationTrackingModeChangeListener listener)
Sets a callback that's invoked when the location tracking mode changes.
|
void |
setOnScrollListener(MapboxMap.OnScrollListener listener)
Sets a callback that's invoked when the map is scrolled.
|
void |
setPadding(int left,
int top,
int right,
int bottom)
Sets the distance from the edges of the map view’s frame to the edges of the map
view’s logical viewport.
|
void |
setStyle(java.lang.String style)
Deprecated.
use
setStyleUrl(String) instead with versioned url methods from Style |
void |
setStyleUrl(java.lang.String url)
Loads a new map style from the specified URL.
|
void |
snapshot(MapboxMap.SnapshotReadyCallback callback)
Takes a snapshot of the map.
|
void |
snapshot(MapboxMap.SnapshotReadyCallback callback,
android.graphics.Bitmap bitmap)
Takes a snapshot of the map.
|
void |
updateMarker(Marker updatedMarker)
Updates a marker on this map.
|
public void setMinZoom(double minZoom)
Sets the minimum zoom level the map can be displayed at.
minZoom - The new minimum zoom level.public double getMinZoom()
Gets the maximum zoom level the map can be displayed at.
public void setMaxZoom(double maxZoom)
Sets the maximum zoom level the map can be displayed at.
maxZoom - The new maximum zoom level.public double getMaxZoom()
Gets the maximum zoom level the map can be displayed at.
public UiSettings getUiSettings()
public TrackingSettings getTrackingSettings()
public MyLocationViewSettings getMyLocationViewSettings()
public Projection getProjection()
public final CameraPosition getCameraPosition()
public void setCameraPosition(CameraPosition cameraPosition)
cameraPosition - public final void moveCamera(CameraUpdate update)
update - The change that should be applied to the camera.public final void moveCamera(CameraUpdate update, MapboxMap.CancelableCallback callback)
update - The change that should be applied to the camera.public final void easeCamera(CameraUpdate update)
CameraUpdate. If getCameraPosition() is called during the animation,
it will return the current location of the camera in flight.update - The change that should be applied to the camera.for a set of updates.public final void easeCamera(CameraUpdate update, int durationMs)
CameraUpdate. If getCameraPosition() is called
during the animation, it will return the current location of the camera in flight.update - The change that should be applied to the camera.durationMs - The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.for a set of updates.public final void easeCamera(CameraUpdate update, int durationMs, MapboxMap.CancelableCallback callback)
CameraUpdate. A callback can be used to be notified when
easing the camera stops. If getCameraPosition() is called during the animation, it
will return the current location of the camera in flight.update - The change that should be applied to the camera.durationMs - The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.callback - An optional callback to be notified from the main thread when the animation
stops. If the animation stops due to its natural completion, the callback
will be notified with onFinish(). If the animation stops due to interruption
by a later camera movement or a user gesture, onCancel() will be called.
Do not update or ease the camera from within onCancel().for a set of updates.public final void easeCamera(CameraUpdate update, int durationMs, boolean easingInterpolator)
public final void easeCamera(CameraUpdate update, int durationMs, boolean easingInterpolator, MapboxMap.CancelableCallback callback)
public final void animateCamera(CameraUpdate update)
CameraUpdate using a transition
animation that evokes powered flight. The animation will last the default amount of time.
During the animation, a call to getCameraPosition() returns an intermediate location
of the camera in flight.update - The change that should be applied to the camera.for a set of updates.public final void animateCamera(CameraUpdate update, MapboxMap.CancelableCallback callback)
CameraUpdate using a transition
animation that evokes powered flight. The animation will last the default amount of time. A
callback can be used to be notified when animating the camera stops. During the animation, a
call to getCameraPosition() returns an intermediate location of the camera in flight.update - The change that should be applied to the camera.callback - The callback to invoke from the main thread when the animation stops. If the
animation completes normally, onFinish() is called; otherwise, onCancel() is
called. Do not update or animate the camera from within onCancel().for a set of updates.public final void animateCamera(CameraUpdate update, int durationMs)
CameraUpdate using a transition
animation that evokes powered flight. The animation will last a specified amount of time
given in milliseconds. During the animation, a call to getCameraPosition() returns
an intermediate location of the camera in flight.update - The change that should be applied to the camera.durationMs - The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.for a set of updates.public final void animateCamera(CameraUpdate update, int durationMs, MapboxMap.CancelableCallback callback)
CameraUpdate using a transition
animation that evokes powered flight. The animation will last a specified amount of time
given in milliseconds. A callback can be used to be notified when animating the camera stops.
During the animation, a call to getCameraPosition() returns an intermediate location
of the camera in flight.update - The change that should be applied to the camera.durationMs - The duration of the animation in milliseconds. This must be strictly
positive, otherwise an IllegalArgumentException will be thrown.callback - An optional callback to be notified from the main thread when the animation
stops. If the animation stops due to its natural completion, the callback
will be notified with onFinish(). If the animation stops due to interruption
by a later camera movement or a user gesture, onCancel() will be called.
Do not update or animate the camera from within onCancel(). If a callback
isn't required, leave it as null.for a set of updates.public void resetNorth()
public boolean isDebugActive()
public void setDebugActive(boolean debugActive)
Changes whether the map debug information is shown.
The default value is false.debugActive - If true, map debug information is shown.public void cycleDebugOptions()
Cycles through the map debug options.
The value ofMapView.isDebugActive() reflects whether there are
any map debug options enabled or disabled.MapView.isDebugActive()public void setStyleUrl(java.lang.String url)
Loads a new map style from the specified URL.
url can take the following forms:
Style.*: load one of the bundled styles in Style.mapbox://styles/<user>/<style>:
retrieves the style from a Mapbox account.
user is your username. style is the ID of your custom
style created in Mapbox Studio.http://... or https://...:
retrieves the style over the Internet from any web server.asset://...:
reads the style from the APK assets/ directory.
This is used to load a style bundled with your app.null: loads the default Style.MAPBOX_STREETS style.
This method is asynchronous and will return immediately before the style finishes loading.
If you wish to wait for the map to finish loading listen for the MapView.DID_FINISH_LOADING_MAP event.
MapView.DID_FAIL_LOADING_MAP event will be sent.url - The URL of the map styleStyle@Deprecated public void setStyle(java.lang.String style)
setStyleUrl(String) instead with versioned url methods from StyleLoads a new map style from the specified bundled style.
This method is asynchronous and will return immediately before the style finishes loading.
If you wish to wait for the map to finish loading listen for the MapView.DID_FINISH_LOADING_MAP event.
MapView.DID_FAIL_LOADING_MAP event will be sent.public java.lang.String getStyleUrl()
Returns the map style currently displayed in the map view.
If the default style is currently displayed, a URL will be returned instead of null.@Deprecated public void setAccessToken(java.lang.String accessToken)
MapboxAccountManager.start(Context, String)DEPRECATED @see MapboxAccountManager#start(String)
Sets the current Mapbox access token used to load map styles and tiles.
accessToken - Your public Mapbox access token.MapView.setAccessToken(String)@Deprecated public java.lang.String getAccessToken()
MapboxAccountManager.getAccessToken()DEPRECATED @see MapboxAccountManager#getAccessToken()
Returns the current Mapbox access token used to load map styles and tiles.
public Marker addMarker(MarkerOptions markerOptions)
Adds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position.
If Marker.title is defined, the map shows an info box with the marker's title and snippet.markerOptions - A marker options object that defines how to render the marker.Marker that was added to the map.public Marker addMarker(BaseMarkerOptions markerOptions)
Adds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position.
If Marker.title is defined, the map shows an info box with the marker's title and snippet.markerOptions - A marker options object that defines how to render the marker.Marker that was added to the map.public MarkerView addMarker(BaseMarkerViewOptions markerOptions)
Adds a marker to this map.
The marker's icon is rendered on the map at the locationMarker.position.
If Marker.title is defined, the map shows an info box with the marker's title and snippet.markerOptions - A marker options object that defines how to render the marker.Marker that was added to the map.public java.util.List<Marker> addMarkers(java.util.List<? extends BaseMarkerOptions> markerOptionsList)
Adds multiple markers to this map.
The marker's icon is rendered on the map at the locationMarker.position.
If Marker.title is defined, the map shows an info box with the marker's title and snippet.markerOptionsList - A list of marker options objects that defines how to render the markers.Markers that were added to the map.public void updateMarker(Marker updatedMarker)
Updates a marker on this map. Does nothing if the marker is already added.
updatedMarker - An updated marker object.public Polyline addPolyline(PolylineOptions polylineOptions)
polylineOptions - A polyline options object that defines how to render the polyline.Polyine that was added to the map.public java.util.List<Polyline> addPolylines(java.util.List<PolylineOptions> polylineOptionsList)
polylineOptionsList - A list of polyline options objects that defines how to render the polylines.Polylines that were added to the map.public Polygon addPolygon(PolygonOptions polygonOptions)
polygonOptions - A polygon options object that defines how to render the polygon.Polygon that was added to the map.public java.util.List<Polygon> addPolygons(java.util.List<PolygonOptions> polygonOptionsList)
polygonOptionsList - A list of polygon options objects that defines how to render the polygons.Polygons that were added to the map.public void removeMarker(Marker marker)
Convenience method for removing a Marker from the map.
Calls removeAnnotation() internallymarker - Marker to removepublic void removePolyline(Polyline polyline)
Convenience method for removing a Polyline from the map.
Calls removeAnnotation() internallypolyline - Polyline to removepublic void removePolygon(Polygon polygon)
Convenience method for removing a Polygon from the map.
Calls removeAnnotation() internallypolygon - Polygon to removepublic void removeAnnotation(Annotation annotation)
annotation - The annotation object to remove.public void removeAnnotation(long id)
id - The identifier associated to the annotation to be removedpublic void removeAnnotations(java.util.List<? extends Annotation> annotationList)
annotationList - A list of annotation objects to remove.public void removeAnnotations()
public void clear()
public Annotation getAnnotation(long id)
public java.util.List<Annotation> getAnnotations()
public java.util.List<Marker> getMarkers()
public java.util.List<Polygon> getPolygons()
public java.util.List<Polyline> getPolylines()
public void selectMarker(Marker marker)
Selects a marker. The selected marker will have it's info window opened. Any other open info windows will be closed unless isAllowConcurrentMultipleOpenInfoWindows() is true.
Selecting an already selected marker will have no effect.marker - The marker to select.public void deselectMarkers()
public void deselectMarker(Marker marker)
public java.util.List<Marker> getSelectedMarkers()
public MarkerViewManager getMarkerViewManager()
public void setInfoWindowAdapter(MapboxMap.InfoWindowAdapter infoWindowAdapter)
Sets a custom renderer for the contents of info window.
When set your callback is invoked when an info window is about to be shown. By returning a customView, the default info window will be replaced.infoWindowAdapter - The callback to be invoked when an info window will be shown.
To unset the callback, use null.public MapboxMap.InfoWindowAdapter getInfoWindowAdapter()
public void setAllowConcurrentMultipleOpenInfoWindows(boolean allow)
allow - If true, map allows concurrent multiple infowindows to be shown.public boolean isAllowConcurrentMultipleOpenInfoWindows()
public void setPadding(int left,
int top,
int right,
int bottom)
Sets the distance from the edges of the map view’s frame to the edges of the map view’s logical viewport.
When the value of this property is equal to {0,0,0,0}, viewport properties such as `centerCoordinate` assume a viewport that matches the map view’s frame. Otherwise, those properties are inset, excluding part of the frame from the viewport. For instance, if the only the top edge is inset, the map center is effectively shifted downward.
left - The left margin in pixels.top - The top margin in pixels.right - The right margin in pixels.bottom - The bottom margin in pixels.public int[] getPadding()
public void setOnCameraChangeListener(MapboxMap.OnCameraChangeListener listener)
listener - The callback that's invoked on every camera change position.
To unset the callback, use null.public void setOnFpsChangedListener(MapboxMap.OnFpsChangedListener listener)
listener - The callback that's invoked on every frame rendered to the map view.
To unset the callback, use null.public void setOnScrollListener(MapboxMap.OnScrollListener listener)
listener - The callback that's invoked when the map is scrolled.
To unset the callback, use null.public void setOnFlingListener(MapboxMap.OnFlingListener listener)
listener - The callback that's invoked when the map is flinged.
To unset the callback, use null.public void setOnMapClickListener(MapboxMap.OnMapClickListener listener)
listener - The callback that's invoked when the user clicks on the map view.
To unset the callback, use null.public void setOnMapLongClickListener(MapboxMap.OnMapLongClickListener listener)
listener - The callback that's invoked when the user long clicks on the map view.
To unset the callback, use null.public void setOnMarkerClickListener(MapboxMap.OnMarkerClickListener listener)
listener - The callback that's invoked when the user clicks on a marker.
To unset the callback, use null.public void setOnInfoWindowClickListener(MapboxMap.OnInfoWindowClickListener listener)
listener - The callback that's invoked when the user clicks on an info window.
To unset the callback, use null.public MapboxMap.OnInfoWindowClickListener getOnInfoWindowClickListener()
public void setOnInfoWindowLongClickListener(MapboxMap.OnInfoWindowLongClickListener listener)
listener - The callback that's invoked when a marker's info window is long pressed. To unset the callback, use null.public MapboxMap.OnInfoWindowLongClickListener getOnInfoWindowLongClickListener()
public void setOnInfoWindowCloseListener(MapboxMap.OnInfoWindowCloseListener listener)
public MapboxMap.OnInfoWindowCloseListener getOnInfoWindowCloseListener()
public boolean isMyLocationEnabled()
public void setMyLocationEnabled(boolean enabled)
Enables or disables the my-location layer. While enabled, the my-location layer continuously draws an indication of a user's current location and bearing.
In order to use the my-location layer feature you need to request permission for eitherManifest.permission.ACCESS_COARSE_LOCATION
or @link android.Manifest.permission#ACCESS_FINE_LOCATION.enabled - True to enable; false to disable.public android.location.Location getMyLocation()
public void setOnMyLocationChangeListener(MapboxMap.OnMyLocationChangeListener listener)
listener - The callback that's invoked when the user clicks on a marker.
To unset the callback, use null.public void setOnMyLocationTrackingModeChangeListener(MapboxMap.OnMyLocationTrackingModeChangeListener listener)
listener - The callback that's invoked when the location tracking mode changes.
To unset the callback, use null.public void setOnMyBearingTrackingModeChangeListener(MapboxMap.OnMyBearingTrackingModeChangeListener listener)
listener - The callback that's invoked when the bearing tracking mode changes.
To unset the callback, use null.public void addCustomLayer(CustomLayer customLayer, java.lang.String before)
public void removeCustomLayer(java.lang.String id)
public void invalidateCustomLayers()
public void invalidate()
public void snapshot(MapboxMap.SnapshotReadyCallback callback, android.graphics.Bitmap bitmap)
callback - Callback method invoked when the snapshot is taken.bitmap - A pre-allocated bitmap.public void snapshot(MapboxMap.SnapshotReadyCallback callback)
callback - Callback method invoked when the snapshot is taken.