Skip to content
andygup edited this page Oct 19, 2012 · 13 revisions

Public Methods

Adding different base maps via latitude, longitude.

The addLayer() method is an overloaded method that let's you specify some of the most common base maps via a simple ENUM, as well as use latitude, longitude and scale. You can also specify visibility when using multiple maps. An example of using multiple maps is allowing the user to toggle between Streets and Satellite.

addLayer(MapType maptype,Double latitude, Double longitude, Double scale, Boolean visible)

This method returns an ArcGISTiledMapServiceLayer.

Changing Map Visibility

When you have multiple maps the setBaseMapVisibility() method lets you easily toggle which map is visible.

setBaseMapVisibility(MapType maptype)

This method returns void.

Checking if a map layer exists

layerExists() is an overloaded method that lets you verify a map layer exists and has been fully initialized before performing an operation against it.

layerExists(MapType maptype)

This method returns Boolean.

Checking if a drawing/Graphics layer exists

layerExists() is an overloaded method that lets you verify a drawing (or Graphics) layer exists and has been fully initialized before performing an operation against it.

layerExists(GraphicsLayer graphicsLayer)

This method returns Boolean.

Getting the current visible map name.

getCurrentVisibileLayerName() lets you programmatically determine which mapping layer is visible.

getCurrentVisibleLayerName()

This method returns String.

Find the closes Graphic based on a user touching the map.

findClosestGraphic() simplifies finding the nearest point. An example use case is when you are displaying multiple coffee shops and you want to return a reference to the Graphic that is closest to where the user touches the map.

findClosestGraphic(float x, float y,GraphicsLayer graphicsLayer,int tolerance)

This method returns the Graphic.

Adding a graphic to the map by latitude and longitude.

addGraphicLatLon() provides an easy way to use lats and lons to create a Graphic.

addGraphicLatLon(double latitude, double longitude, Map attributes, SimpleMarkerSymbol.STYLE style)

This method returns void.

Draw a line via latitude and longitude coordinates

addGraphicLine() lets you take a String array of lats and lons and create a simple line on the map.

addGraphicLine(String[] lineArray, SimpleLineSymbol.STYLE style, int color)

This method returns void.

Center the map via latitude and longitude

centerAt() is an overloaded method of MapView that lets you center the map using a latitude and longitude coordinate.

centerAt(double latitude, double longitude, boolean animated)

This method returns void.

Find an address

findAddress(String address)

This method returns void.

Find an address by touching map

findAddressByXY(float x, float y)

This method returns void.

Find an address by latitude and longitude

findAddressByLatLon(double latitude, double longitude)

This method returns void.

Repetitively display a toast message

displayToast() gives you a single line pattern that can be used for repetitive tasks that require toast messages.

displayToast(String message,int... toastLength)

This method returns void.

Specify a point, line or polygon draw type.

setDrawType() lets you use a single line pattern for specifying whether you want to draw a point, line or polygon.

setDrawType(DrawType drawType)

This method returns void.

Starting GPS (threadsafe)

delayedStartLocationService() provides an easy and safe way of starting the GPS that automatically checks that the map has been initialized before starting to use GPS coordinates to manipulate the map. It also provides a snapshot mode that will allow the GPS accuracy to settle to a predetermined point and then automatically shutdown.

delayedStartLocationService(final boolean...gpsSnapshotMode)

This method returns void.

Stopping GPS (threadsafe)

stopLocationService() attempts to stop the location service and throws an error event after a fixed number of unsuccessful attempts.

stopLocationService(final Boolean... silent)

This method returns void.

Determine last known location

getLastKnownLocation() is a single line way of retrieving the last known location from the device.

getLastKnownLocation()

This method returns Location.

Pause the map

pause() is an overloaded method that lets you gracefully pause map operations during the application lifecycle.

pause()

This method returns void.

Unpause the map

pause() is an overloaded method that lets you gracefully unpause the map operations during the application lifecycle.

unpause()

This method returns void.


Event Listeners

Add QuickStart event listeners

addEventListener(EsriQuickStartEventListener listener)

This method returns void.

Remove QuickStart event listeners

removeEventListener(EsriQuickStartEventListener listener)

This method returns void.

Restore the default map touch listener.

Use this in conjunction with the setDrawTouchListener().

setDefaultTouchListener()

This method returns void.

Turn on map drawing listener

setDrawTouchListener() lets you enable drawing capabilities and lock the map so it doesn't move while the user is drawing.

setDrawTouchListener()

This method returns void.


Public Properties

Return an instance of the Map

getMapView() returns a references to the INTERNAL MapView instance.

getMapView()

This method returns MapView.

Check if location is enabled.

isLocationEnabled() provides a single line pattern for determining if GPS_PROVIDER is set.

isLocationEnabled()

isLocationEnabled()

This method returns boolean.

Check if location is started

isLocationStarted() returns whether or not the location service has been started.

isLocationStarted()

This method returns boolean.

Get reference to streets map

getStreetsLayer()

This method returns ArcGISTiledMapServiceLayer.

Get reference to topo map

getTopoLayer()

This method returns ArcGISTiledMapServiceLayer.

Get reference to satellite map

getSatelliteLayer()

This method returns ArcGISTiledMapServiceLayer.

Get reference to drawing layer

getDrawLayer()

This method returns GraphicsLayer.

Check if base map loaded

Lets you determine if the map is fully initialized and ready to be used.

isMapLoaded()

This method returns boolean.

Set the map type ENUM

Single line pattern for setting the map.


MapType.STREETS
MapType.TOPO
MapType.SATELLITE

This method returns enum.

Set the draw type ENUM

Single line pattern for setting the draw tool.


DrawType.POINT
DrawType.POLYLINE
DrawType.POLYGON

This method returns enum.

Clone this wiki locally