public final class

MapView

extends GeoView
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ com.esri.arcgisruntime.mapping.view.GeoView
         ↳ com.esri.arcgisruntime.mapping.view.MapView

Class Overview

A MapView renders the data from an ArcGISMap in an Android layout, and allows users to interact with the map.

MapView indirectly inherits from android's ViewGroup; in a Model View Controller (MVC) architecture, use it to represent the MVC view, and the ArcGISMap to represent the MVC model. You can define the size and layout properties of a MapView in layout XML, or create it programmatically. In either case, call setMap to set the content to be displayed. The mapview will automatically load the map, its basemap, operational layers, and display their contents on screen. Refer to the ArcGISMap class for more information.

MapView inherits from GeoView and adds 2D specific methods for map navigation that set the visible area of the map (the current extent) by setting a Viewpoint. For example, setViewpointGeometryAsync zooms the map to the extent of a geometry, and setViewpointCenterAsync zooms the map to a given scale, centered at the given Point. More setViewpoint methods are available, including overloads where an animation duration can be specified. Geometries passed to these methods will be automatically re-projected if required. Use isNavigating or NavigationChangedListener to determine if navigation is ongoing or completed. Once navigation is complete, get the new viewpoint from getCurrentViewPoint.

By default, you can pan, zoom, and rotate the map using a set of standard gestures like double-tap and pinch; for more details see DefaultMapViewOnTouchListener. You can also override standard gestures by creating your own touch listener class. To do this, either implement MapView.OnTouchListener, or inherit from DefaultMapViewOnTouchListener, and pass an instance of your touch listener class to setOnTouchListener.

Summary

Nested Classes
interface MapView.OnTouchListener Defines single and multitouch gesture events that can occur on the MapView, such as a multi-pointer tap. 
[Expand]
Inherited Constants
From class android.view.ViewGroup
From class android.view.View
[Expand]
Inherited Fields
From class android.view.View
Public Constructors
MapView(Context context, AttributeSet attrs)
Creates a new MapView using the given Context, called when the MapView is inflated from XML.
MapView(Context context)
Creates a new MapView using the given Context.
Public Methods
void addMapRotationChangedListener(MapRotationChangedListener listener)
Adds a listener for when map rotation has changed.
void addMapScaleChangedListener(MapScaleChangedListener listener)
Adds a listener for when map scale has changed.
boolean canMagnifierPanMap()
Indicates if the magnifier will pan the map when it touches the edge of the MapView.
void dispose()
Releases resources.
BackgroundGrid getBackgroundGrid()
Gets the BackgroundGrid set on the MapView.
Callout getCallout()
Gets the Callout for this MapView.
Grid getGrid()
Gets grid set to the MapView.
ViewLabelProperties getLabeling()
Gets the labeling properties.
LocationDisplay getLocationDisplay()
Returns the MapView's LocationDisplay, used to display the current device location in the MapView.
ArcGISMap getMap()
Gets the ArcGISMap shown in this MapView.
double getMapRotation()
Returns the current rotation angle of the map, in degrees counter-clockwise from its default orientation.
double getMapScale()
Gets the current scale of the map, expressing the relationship between a distance in the MapView and the corresponding distance on the ground.
View.OnTouchListener getOnTouchListener()
Gets the listener that handles touch gestures for this MapView.
SketchEditor getSketchEditor()
Gets the current sketch editor.
SpatialReference getSpatialReference()
Gets the SpatialReference of this GeoView.

This is set by the contained setMap(ArcGISMap), and cannot be changed directly.

double getUnitsPerDensityIndependentPixel()
Gets the number of map units (real world units in the units of the maps spatial reference) per density-independent pixel(dp).
double getViewInsetBottom()
Returns the bottom inset specified on the MapView.
double getViewInsetLeft()
Returns the left inset specified on the MapView.
double getViewInsetRight()
Returns the right inset specified on the MapView.
double getViewInsetTop()
Returns the top inset specified on the MapView.
Polygon getVisibleArea()
Returns a Polygon representing the area of the ArcGISMap that is currently visible in the MapView.
WrapAroundMode getWrapAroundMode()
Gets the current WrapAroundMode that determines if the map is drawn continuously across the 180th meridian.
boolean isMagnifierEnabled()
Indicates if the built-in map magnifier is enabled.
boolean isViewInsetsValid()
Indicates if the configured insets specified on the MapView are currently valid.
Point locationToScreen(Point mapPoint)
Converts a Point in map coordinates to an android.graphics.Point representing device screen coordinates.
void logFrameRate(TextView textView)
For debugging purposes only.
boolean onTouchEvent(MotionEvent event)
Handles touch events on the MapView by delegating them to the currently set OnTouchListener.
boolean removeMapRotationChangedListener(MapRotationChangedListener listener)
Removes a map rotation changed listener.
boolean removeMapScaleChangedListener(MapScaleChangedListener listener)
Removes a map scale changed listener.
Point screenToLocation(Point screenPoint)
Converts an android.graphics.Point representing device screen coordinates in pixels to a Point in map coordinates.
void setBackgroundGrid(BackgroundGrid backgroundGrid)
Sets the BackgroundGrid on the MapView.
void setCanMagnifierPanMap(boolean canMagnifierPanMap)
Enables or disables the ability of the magnifier to pan the map when it touches the edge of the MapView.
void setGrid(Grid grid)
Sets a grid to be displayed on top of the MapView.
void setLabeling(ViewLabelProperties viewLabelProperties)
Sets labeling properties.
void setMagnifierEnabled(boolean magnifierEnabled)
Enables or disables the built-in map magnifier.
void setMap(ArcGISMap map)
Sets the ArcGISMap to display in this MapView.
void setOnTouchListener(View.OnTouchListener onTouchListener)
Sets the listener that handles touch gestures for this MapView.
void setSketchEditor(SketchEditor sketchEditor)
Sets a SketchEditor into this MapView.
void setViewInsets(double left, double top, double right, double bottom)
Sets the specified left, top, right, and bottom insets on the MapView.
ListenableFuture<Boolean> setViewpointAsync(Viewpoint viewpoint, float durationSeconds, AnimationCurve animationCurve)
Asynchronously updates the MapView to the given Viewpoint, taking the given number of seconds to complete and using the supplied AnimationCurve to define the easing function for the animation.
ListenableFuture<Boolean> setViewpointCenterAsync(Point point)
Asynchronously pans the map, with animation, to the given center Point.
ListenableFuture<Boolean> setViewpointCenterAsync(Point center, double scale)
Asynchronously zooms and pans the map, with animation, to the given center Point and map scale.
ListenableFuture<Boolean> setViewpointGeometryAsync(Geometry boundingGeometry)
Asynchronously zooms the map, with animation, to show the given Geometry.
ListenableFuture<Boolean> setViewpointGeometryAsync(Geometry boundingGeometry, double padding)
Asynchronously zooms the map, with animation, to show the given Geometry, with the given padding around the Geometry.
ListenableFuture<Boolean> setViewpointRotationAsync(double angleDegrees)
Asynchronously rotates the map, with animation, to the given angle.
ListenableFuture<Boolean> setViewpointScaleAsync(double scale)
Asynchronously zooms the map, with animation, to the given scale.
void setWrapAroundMode(WrapAroundMode wrapAroundMode)
Sets the WrapAroundMode to determine if the map should be drawn continuously across the 180th meridian.
void setZOrderMediaOverlay(boolean isMediaOverlay)
Controls whether the MapView is placed on top of another MapView, SceneView, or SurfaceView in the window (but still behind the window itself).
Protected Methods
void onDrawFrame(GL10 gl)
Called to draw the current frame.
[Expand]
Inherited Methods
From class com.esri.arcgisruntime.mapping.view.GeoView
From class android.view.ViewGroup
From class android.view.View
From class java.lang.Object
From interface android.graphics.drawable.Drawable.Callback
From interface android.view.KeyEvent.Callback
From interface android.view.ViewManager
From interface android.view.ViewParent
From interface android.view.accessibility.AccessibilityEventSource

Public Constructors

public MapView (Context context, AttributeSet attrs)

Creates a new MapView using the given Context, called when the MapView is inflated from XML.

Parameters
context The Context the view is running in, through which it can access the current theme, resources, etc. For example, this may be the instance of the Activity or Fragment that the MapView is inflated into.
attrs The attributes of the XML tag that is inflating the view.

public MapView (Context context)

Creates a new MapView using the given Context. Call this constructor when creating a MapView programmatically.

Parameters
context The Context the view is running in, through which it can access the current theme, resources, etc.

Public Methods

public void addMapRotationChangedListener (MapRotationChangedListener listener)

Adds a listener for when map rotation has changed.

Parameters
listener the listener
Throws
IllegalArgumentException if the listener is null

public void addMapScaleChangedListener (MapScaleChangedListener listener)

Adds a listener for when map scale has changed.

Parameters
listener the listener
Throws
IllegalArgumentException if the listener is null

public boolean canMagnifierPanMap ()

Indicates if the magnifier will pan the map when it touches the edge of the MapView. The default is false.

To use magnifier panning, you must enable the magnifier using setMagnifierEnabled(boolean).

Returns
  • true if the magnifier can pan the map; false otherwise

public void dispose ()

Releases resources. Call this when you are finished with a view.

public BackgroundGrid getBackgroundGrid ()

Gets the BackgroundGrid set on the MapView.

Returns
  • the BackgroundGrid currently set on the MapView

public Callout getCallout ()

Gets the Callout for this MapView. A callout displays an Android View that contains text and/or other content. A MapView has only one Callout.

Returns
  • the Callout object for this MapView

public Grid getGrid ()

Gets grid set to the MapView.

Returns
  • grid set to the MapView, null if not set

public ViewLabelProperties getLabeling ()

Gets the labeling properties. The ViewLabelProperties denote whether labels and label animation are enabled or not. These values cannot be changed by reference. To change the values, a ViewLabelProperties instance must be set on the MapView with setLabeling(ViewLabelProperties).

Returns
  • the label properties

public LocationDisplay getLocationDisplay ()

Returns the MapView's LocationDisplay, used to display the current device location in the MapView. A MapView only has one LocationDisplay.

Returns
  • the LocationDisplay object

public ArcGISMap getMap ()

Gets the ArcGISMap shown in this MapView. By default, the ArcGISMap is null, and must be set by calling setMap(ArcGISMap).

Returns
  • the ArcGISMap displayed in this MapView. Default is null.

public double getMapRotation ()

Returns the current rotation angle of the map, in degrees counter-clockwise from its default orientation.

To change the rotation of the map programmatically, use the setViewpointRotationAsync(double) method. Users can interactively rotate the map by using a two-pointer-rotate gesture on the MapView.

Returns
  • the map rotation in degrees.

public double getMapScale ()

Gets the current scale of the map, expressing the relationship between a distance in the MapView and the corresponding distance on the ground. For example, a map scale of 100,000 indicates that one centimeter on the map equates to one kilometer on the ground.

To set the MapView to display a particular map scale, call setViewpointScaleAsync(double) or setViewpointCenterAsync(Point, double).

Returns
  • a double representing the current map scale

public View.OnTouchListener getOnTouchListener ()

Gets the listener that handles touch gestures for this MapView. The default value is an instance of DefaultMapViewOnTouchListener, which implements the default gestures for a MapView. To customize the gestures this MapView responds to, use setOnTouchListener(View.OnTouchListener).

Returns
  • the current OnTouchListener

public SketchEditor getSketchEditor ()

Gets the current sketch editor.

Returns
  • the current sketch editor, or null if it is not set

public SpatialReference getSpatialReference ()

Gets the SpatialReference of this GeoView. The SpatialReference of a GeoView defines how the coordinates of the data correspond to locations in the real world.

This is set by the contained setMap(ArcGISMap), and cannot be changed directly. Use the addSpatialReferenceChangedListener(SpatialReferenceChangedListener) method to be notified when a change in the contained map changes this SpatialReference.

Returns
  • the SpatialReference of this GeoView

public double getUnitsPerDensityIndependentPixel ()

Gets the number of map units (real world units in the units of the maps spatial reference) per density-independent pixel(dp). This is the current spatial resolution of the map on the screen and can be used to calculate map distances on the screen and effective scales.

Returns
  • the number of map units per density-independent pixel

public double getViewInsetBottom ()

Returns the bottom inset specified on the MapView.

Returns
  • the inset set on the bottom edge of the MapView in density-independent pixels (dp)

public double getViewInsetLeft ()

Returns the left inset specified on the MapView.

Returns
  • the inset set on the left edge of the MapView in density-independent pixels (dp)

public double getViewInsetRight ()

Returns the right inset specified on the MapView.

Returns
  • the inset set on the right edge of the MapView in density-independent pixels (dp)

public double getViewInsetTop ()

Returns the top inset specified on the MapView.

Returns
  • the inset set on the top edge of the MapView in density-independent pixels (dp)

public Polygon getVisibleArea ()

Returns a Polygon representing the area of the ArcGISMap that is currently visible in the MapView. When a new ArcGISMap is set into the MapView, the default value of the visible area is set from getInitialViewpoint().

The visible area changes whenever the ArcGISMap is navigated interactively by the user, or programmatically by calling a setViewpoint method for example. Use addViewpointChangedListener(ViewpointChangedListener) to be notified when this value changes, regardless of how the change occurred.

Returns
  • the visible area of the ArcGISMap, or null if the ArcGISMap is not yet loaded

public WrapAroundMode getWrapAroundMode ()

Gets the current WrapAroundMode that determines if the map is drawn continuously across the 180th meridian. The default value of ENABLE_WHEN_SUPPORTED means that the map is drawn continuously if the minimum requirements for wrap around display are met; see ENABLE_WHEN_SUPPORTED for more information about the requirements.

Note that the isWrapAroundEnabled() can be used to check if the map is actually being displayed continuously (when the mode is ENABLE_WHEN_SUPPORTED and the requirements are met).

Returns
  • the current WrapAroundMode

public boolean isMagnifierEnabled ()

Indicates if the built-in map magnifier is enabled. When enabled, the magnifier is shown when you long-press on the MapView. The default is false. Enable or disable the magnifier using setMagnifierEnabled(boolean).

Returns
  • true if the magnifier is enabled; false otherwise

public boolean isViewInsetsValid ()

Indicates if the configured insets specified on the MapView are currently valid. Can be used to find out the validity of insets when MapView is resized.

Returns
  • true if the insets are smaller than the current view size; false if they are equal to or larger

public Point locationToScreen (Point mapPoint)

Converts a Point in map coordinates to an android.graphics.Point representing device screen coordinates. Coordinate values are in pixels, relative to the top-left corner of the MapView's screen location.

Use this method to help perform custom drawing, or to locate Views, relative to specific map coordinates. For example, calculate the screen coordinates at which to show a Button so that it displays adjacent to a specific feature or raster cell in the map.

This method will attempt to convert any coordinates within the MapView's SpatialReference, and therefore can result in coordinates outside the actual screen bounds. For example if a map of the world is zoomed in to the extent of Africa, a map location within South America would result in a point off screen. If necessary, you can use android.util.DisplayMetrics to check the screen coordinate bounds.

If isWrapAroundEnabled() is true, then map is drawn as continuous horizontal repeats, allowing you to pan continuously - this means that one map location could relate to multiple potential screen locations. In this case, if the map location lies within the screen bounds then that location is used; otherwise the location closest to the center of the view is used.

Parameters
mapPoint the Point representing map coordinates to convert
Returns
  • an android.graphics.Point representing screen coordinates in pixels. The x and y fields of this point will be set to NaN if an error occurs.
Throws
IllegalArgumentException if mapPoint is null

public void logFrameRate (TextView textView)

For debugging purposes only. Logs the MapView's frame rate to the specified TextView.

The value logged is the average number of frames drawn per second. Note that this is an estimate and not precisely accurate. Passing null disables frame rate logging.

Note that when the map is stationary there is no render pulse and the frame rate cannot be measured properly. This may result in very low frame rates being displayed in the TextView, especially after initial map start-up and initial navigation. You should navigate the map for a few seconds to see realistic frame rates.

The maximum frame rate is 60 frames per second.

Parameters
textView a TextView to which the frame rate is written, or null to stop logging the frame rate

public boolean onTouchEvent (MotionEvent event)

Handles touch events on the MapView by delegating them to the currently set OnTouchListener.

Parameters
event the MotionEvent to handle
Returns
  • true if the listener has consumed the event; false otherwise

public boolean removeMapRotationChangedListener (MapRotationChangedListener listener)

Removes a map rotation changed listener.

Parameters
listener the listener
Returns
  • true, if successful

public boolean removeMapScaleChangedListener (MapScaleChangedListener listener)

Removes a map scale changed listener.

Parameters
listener the listener
Returns
  • true, if successful

public Point screenToLocation (Point screenPoint)

Converts an android.graphics.Point representing device screen coordinates in pixels to a Point in map coordinates.

Use this method to convert MotionEvent coordinates from touch events on the view into corresponding locations on the map; for example, converting screen coordinates passed to the onSingleTapConfirmed method on android.view.GestureDetector.OnDoubleTapListener into map coordinates to use as the location of a Callout.

Parameters
screenPoint the android.graphics.Point representing screen coordinates, in pixels, to convert
Returns
  • the Point representing map coordinates
Throws
IllegalArgumentException if the argument is null

public void setBackgroundGrid (BackgroundGrid backgroundGrid)

Sets the BackgroundGrid on the MapView.

Parameters
backgroundGrid the BackgroundGrid to be applied to the MapView
Throws
IllegalArgumentException if the backgroundGrid is null

public void setCanMagnifierPanMap (boolean canMagnifierPanMap)

Enables or disables the ability of the magnifier to pan the map when it touches the edge of the MapView.

To use magnifier panning, you must enable the magnifier using setMagnifierEnabled(boolean).

Parameters
canMagnifierPanMap true to allow the magnifier to pan the map view, default is false

public void setGrid (Grid grid)

Sets a grid to be displayed on top of the MapView.

If a developer wants to temporarily hide the grid, they can change the grid's visibility. Setting a grid to not visible will hide the grid and its labels. This method should be used in preference to setting the grid to null, which is an expensive operation.

Parameters
grid grid to display on top of the MapView, can be null

public void setLabeling (ViewLabelProperties viewLabelProperties)

Sets labeling properties. The ViewLabelProperties can be used to enable or disable labels and label animation.

Parameters
viewLabelProperties the label properties to set
Throws
IllegalArgumentException if viewLabelProperties is null

public void setMagnifierEnabled (boolean magnifierEnabled)

Enables or disables the built-in map magnifier. When enabled, the magnifier is shown when you long-press on the MapView. The current state of the magnifier is returned from isMagnifierEnabled().

The magnifier allows you to precisely locate a location by centering the crosshairs at the required location, instead of using the location of a tap gesture. Get the exact location of the final magnifier crosshair location by responding to the OnTouchListener.onUp() method, instead of using the motion event received by onLongPress().

Parameters
magnifierEnabled true to enable the magnifier; false otherwise

public void setMap (ArcGISMap map)

Sets the ArcGISMap to display in this MapView. By default, the MapView does not contain an ArcGISMap, and one must be set by calling setMap, which then asynchronously loads the map by calling Loadable.loadAsync on the ArcGISMap.

Use the addDrawStatusChangedListener(DrawStatusChangedListener) method to add a listener to be called when the drawing has completed, or check getDrawStatus(). Alternatively, use the addDoneLoadingListener(Runnable) method to be notified when the ArcGISMap has finished loading.

Properties of the MapView that rely on the ArcGISMap may be null or invalid until the map has finished loading. If a Viewpoint is set immediately after calling setMap, the Viewpoint will be cached, and then applied as soon as the ArcGISMap is loaded, overriding the default Viewpoint. The SpatialReference of the loaded ArcGISMap will set the SpatialReference of this MapView; a change in SpatialReference will raise the SpatialReferenceChangedEvent.

Parameters
map the new ArcGISMap to display in this MapView. May be null.

public void setOnTouchListener (View.OnTouchListener onTouchListener)

Sets the listener that handles touch gestures for this MapView. For more information about the default gestures, see DefaultMapViewOnTouchListener.

To change the way that the MapView responds to default gestures, for example by performing an identify on a single-tap, or disabling interactive panning, use this method to set a custom touch listener onto the MapView.

The easiest way to change only some of the default gestures is to create a custom touch listener that inherits DefaultMapViewOnTouchListener, and override only the methods you want to change. Alternatively, directly implement the MapView.OnTouchListener or android.view.View.OnTouchListener interface, and provide the behaviour for all touch events. Then pass an instance to this method to replace the default listener with your custom listener.

Parameters
onTouchListener the new listener that will handle touch events for this MapView
Throws
IllegalArgumentException if the listener is null

public void setSketchEditor (SketchEditor sketchEditor)

Sets a SketchEditor into this MapView. If another SketchEditor instance is currently set it will be stopped and replaced by the given SketchEditor.

Parameters
sketchEditor a SketchEditor object
See Also

public void setViewInsets (double left, double top, double right, double bottom)

Sets the specified left, top, right, and bottom insets on the MapView. Insets controls the active visible area, instructing the MapView to ignore parts that may be obstructed by overlaid UI elements and affecting the MapView's logical center, the reported visible area and the location display. Units for left, top, right, and bottom are specified in density-independent pixels (dp). The Insets may be invalidated if the MapView is resized without the Insets being updated. Invalid Inset values are ignored.

Parameters
left the inset on the left edge of the view
top the inset on the top edge of the view
right the inset on the right edge of the view
bottom the inset on the bottom edge of the view

public ListenableFuture<Boolean> setViewpointAsync (Viewpoint viewpoint, float durationSeconds, AnimationCurve animationCurve)

Asynchronously updates the MapView to the given Viewpoint, taking the given number of seconds to complete and using the supplied AnimationCurve to define the easing function for the animation. Alternatively use setViewpointAsync(Viewpoint) to use the standard duration and animation curve or setViewpointAsync(Viewpoint, float) to use the standard animation curve.

Parameters
viewpoint the viewpoint being animated to
durationSeconds the duration of the animation in seconds
animationCurve the animation curve to apply
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.
Throws
IllegalArgumentException if viewpoint is null
IllegalArgumentException if animationCurve is null

public ListenableFuture<Boolean> setViewpointCenterAsync (Point point)

Asynchronously pans the map, with animation, to the given center Point.

Parameters
point the location on which the map should be centered
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.
Throws
IllegalArgumentException if argument is null

public ListenableFuture<Boolean> setViewpointCenterAsync (Point center, double scale)

Asynchronously zooms and pans the map, with animation, to the given center Point and map scale.

Parameters
center the location on which the map should be centered
scale the new map scale
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.
Throws
IllegalArgumentException if center is null
See Also

public ListenableFuture<Boolean> setViewpointGeometryAsync (Geometry boundingGeometry)

Asynchronously zooms the map, with animation, to show the given Geometry. The map scale and center may both change.

Parameters
boundingGeometry the geometry to zoom to. If the SpatialReference of the geometry is different to that of the MapView, it will be reprojected appropriately.
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.
Throws
IllegalArgumentException if the argument is null

public ListenableFuture<Boolean> setViewpointGeometryAsync (Geometry boundingGeometry, double padding)

Asynchronously zooms the map, with animation, to show the given Geometry, with the given padding around the Geometry. The map scale and center may both change.

Parameters
boundingGeometry the geometry to zoom to. If the SpatialReference of the geometry is different to that of the MapView, it will be reprojected appropriately.
padding a distance around the geometry to include in the Viewpoint when zooming, in density-independent pixels
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.
Throws
IllegalArgumentException if boundingGeometry is null

public ListenableFuture<Boolean> setViewpointRotationAsync (double angleDegrees)

Asynchronously rotates the map, with animation, to the given angle.

Parameters
angleDegrees the new map rotation angle, in degrees counter-clockwise.
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.

public ListenableFuture<Boolean> setViewpointScaleAsync (double scale)

Asynchronously zooms the map, with animation, to the given scale. The map center point does not change. The map scale is the number of map units per unit of physical device size. It expresses the relationship between a distance in the MapView and the corresponding distance on the ground. A smaller value will zoom the map in and produce a larger map display area (features appear larger). A larger value will zoom the map out and produce a smaller map display area (features appear smaller).

Alternatively, use getUnitsPerDensityIndependentPixel() to find the number of map units per density-independent pixels.

Parameters
scale the new map scale
Returns
  • a ListenableFuture representing the result of the Viewpoint change. Add a listener to the future to be notified when animation is finished. The result of the future indicates if the operation completed successfully.
See Also

public void setWrapAroundMode (WrapAroundMode wrapAroundMode)

Sets the WrapAroundMode to determine if the map should be drawn continuously across the 180th meridian.

Wrap around map display has some requirements; see ENABLE_WHEN_SUPPORTED for more information. The isWrapAroundEnabled() method can be used to check if the map is currently displayed wrapped around; if so, this implies that these requirements are met and the mode is also ENABLE_WHEN_SUPPORTED.

Parameters
wrapAroundMode the new wrap around mode to set on this MapView

public void setZOrderMediaOverlay (boolean isMediaOverlay)

Controls whether the MapView is placed on top of another MapView, SceneView, or SurfaceView in the window (but still behind the window itself). This could be typically used to place an overview MapView on top of a SceneView. Note that this must be set before the MapView's containing window is attached to the window manager.

Parameters
isMediaOverlay true if this MapView is placed on top of another regular surface view, otherwise false

Protected Methods

protected void onDrawFrame (GL10 gl)

Called to draw the current frame.

Parameters
gl the GL interface