# Class Marker

java.lang.Object
com.codename1.maps.MapObject
com.codename1.maps.Marker

public final class Marker extends MapObject
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(LatLng)`, `setVisible(boolean)`) update the rendered marker on the next repaint.

- ## Method Summary

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

  ### Methods inherited from class MapObject

  `equals, getId, hashCode`

  ### Methods inherited from class Object

  `clone, getClass, notify, notifyAll, toString, wait, wait, wait`

- ## 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`.