public final class Marker

  1. Object
  2. MapObject
  3. Marker
A marker pinned to a geographic location on a map. Create one from a MarkerOptions via MapSurface.addMarker(MarkerOptions); the returned instance is a live handle whose mutators (setPosition, setVisible) update the rendered marker on the next repaint.

Methods

public LatLng getPosition()The marker location.
public void setPosition(LatLng position)Moves the marker to a new location.
public EncodedImage getIcon()The marker icon, or null to use the surface’s default pin.
public String getTitle()The marker title shown in an info window (provider dependent).
public String getSnippet()The secondary text shown beneath the title (provider dependent).
public float getAnchorU()The horizontal icon anchor in normalized [0,1] image space (0 = left, 1 = right).
public float getAnchorV()The vertical icon anchor in normalized [0,1] image space (0 = top, 1 = bottom).
public boolean isDraggable()Whether the user may drag this marker (native providers only).
public boolean isVisible()Whether the marker is currently rendered.
public void setVisible(boolean visible)Shows or hides the marker.
public ActionListener getOnClick()The listener invoked when the marker is tapped, or null.

Inherited methods

Method details

getPosition

public LatLng getPosition()
The marker location.

setPosition

public void setPosition(LatLng position)
Moves the marker to a new location.

getIcon

public EncodedImage getIcon()
The marker icon, or null to use the surface’s default pin.

getTitle

public String getTitle()
The marker title shown in an info window (provider dependent).

getSnippet

public String getSnippet()
The secondary text shown beneath the title (provider dependent).

getAnchorU

public float getAnchorU()
The horizontal icon anchor in normalized [0,1] image space (0 = left, 1 = right). Defaults to 0.5 (centered).

getAnchorV

public float getAnchorV()
The vertical icon anchor in normalized [0,1] image space (0 = top, 1 = bottom). Defaults to 1 (pin tip at the location).

isDraggable

public boolean isDraggable()
Whether the user may drag this marker (native providers only).

isVisible

public boolean isVisible()
Whether the marker is currently rendered.

setVisible

public void setVisible(boolean visible)
Shows or hides the marker.

getOnClick

public ActionListener getOnClick()
The listener invoked when the marker is tapped, or null.