com.mapquest.android.maps
Class MapView

java.lang.Object
  extended by android.view.View
      extended by android.view.ViewGroup
          extended by com.mapquest.android.maps.MapView
All Implemented Interfaces:
android.graphics.drawable.Drawable.Callback, android.view.accessibility.AccessibilityEventSource, android.view.KeyEvent.Callback, android.view.ViewManager, android.view.ViewParent

public class MapView
extends android.view.ViewGroup

A View class which displays MapQuest maps based on the licensed data or OpenStreetMap data. Maps based on licensed data can be used after specifying the API Key in the attribute android:apiKey. The api key can simply be obtained from MapQuest Developer network website. If android:apiKey attribute is not specified, the MapView will display MapQuest styled and hosted OpenSteetMap maps.

See Also:
MapQuest Developer Network

Nested Class Summary
static class MapView.LayoutParams
          Sets the layout options for child views.
static interface MapView.MapViewEventListener
          MapViewEventListeners are a simple way to detect changes in the map state in your code.
static class MapView.ReticleDrawMode
          An enum to specify the drawing mode of the reticle.
 
Nested classes/interfaces inherited from class android.view.ViewGroup
android.view.ViewGroup.MarginLayoutParams, android.view.ViewGroup.OnHierarchyChangeListener
 
Nested classes/interfaces inherited from class android.view.View
android.view.View.BaseSavedState, android.view.View.MeasureSpec, android.view.View.OnClickListener, android.view.View.OnCreateContextMenuListener, android.view.View.OnFocusChangeListener, android.view.View.OnKeyListener, android.view.View.OnLongClickListener, android.view.View.OnTouchListener
 
Field Summary
 
Fields inherited from class android.view.ViewGroup
CLIP_TO_PADDING_MASK, FOCUS_AFTER_DESCENDANTS, FOCUS_BEFORE_DESCENDANTS, FOCUS_BLOCK_DESCENDANTS, PERSISTENT_ALL_CACHES, PERSISTENT_ANIMATION_CACHE, PERSISTENT_NO_CACHE, PERSISTENT_SCROLLING_CACHE
 
Fields inherited from class android.view.View
DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, INVISIBLE, KEEP_SCREEN_ON, NO_ID, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET
 
Constructor Summary
MapView(android.content.Context context)
          Initializes map objects with maps from MapQuest-OpenStreetMap tiles.
MapView(android.content.Context context, android.util.AttributeSet attrs)
          Initializes map objects with maps.
MapView(android.content.Context context, android.util.AttributeSet attrs, int defStyle)
          Initializes map objects with maps.
MapView(android.content.Context context, java.lang.String apiKey)
          Initializes map objects with maps from MapQuest's licensed data.
 
Method Summary
 void addMapViewEventListener(MapView.MapViewEventListener eventListener)
          Adds a MapViewEventListener to this mapView.
 boolean canCoverCenter()
          Checks if the sufficient tiles are loaded to render center of the MapView
protected  boolean checkLayoutParams(android.view.ViewGroup.LayoutParams p)
          Checks if p is instance of MapView.LayoutParams
 void clearTilesInMemory()
          Clears the tile images currently loaded in the memory.
 void destroy()
          Cleans up the map objects, shutdowns the tile loading thread.
 void displayZoomControls(boolean takeFocus)
          Bring the zoom control to front, if enabled and optionally sets the focus to zoom control.
protected  MapView.LayoutParams generateDefaultLayoutParams()
          Generates the new MapView.LayoutParams object with default values.
 android.view.ViewGroup.LayoutParams generateLayoutParams(android.util.AttributeSet attrs)
          Constructs the LayoutParam object from attribute set.
protected  android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams p)
          Constructs the new LayoutParam object from copying the layout values from the source p
 int getBottomMargin()
          Returns the margin at bottom currently applied
 BoundingBox getBoundingBox(BoundingBox bbox)
          Returns the bounding box of earth's region current shown in the map.
 Configuration getConfiguration()
          Get a handle on the configuration object used to configure optional items on the mapView
 MapController getController()
          Returns the MapController object which is used for pan and zoom operations.
 android.graphics.Point getFocalPoint()
          Returns the current point in the screen to which map is centered to.
 int getLatitudeSpan()
          Returns the MapView's latitude span in microdegrees
 int getLeftMargin()
          Returns the margin at top currently applied
 int getLongitudeSpan()
          Returns the MapView's longitude span in microdegrees
 GeoPoint getMapCenter()
          Returns the center point of the MapView
 int getMapHeight()
          Returns the map height required to fill the View.
 float getMapRotation()
           
 int getMapWidth()
          Returns the map width required to fill the View.
 int getMaxZoomLevel()
          Returns the maximum number of zoom levels the MapView supports NOTE: Currently this method is not accurate for Satellite maps.
 Overlay getOverlayByKey(java.lang.String key)
          Returns the overlay identified by the key
 java.util.List<Overlay> getOverlays()
          Returns the overlay list object.
 Projection getProjection()
          Returns the projection class instance to convert GeoPoint to screen coordinates and vice versa.
 int getRightMargin()
          Returns the margin at right currently applied
 int getTopMargin()
          Returns the margin at top currently applied
 android.view.View getZoomControls()
          Return the view to provide zoom in and out operations.
 int getZoomLevel()
          Returns the current zoom level of MapView.
 boolean isSatellite()
          Checks if the map is in satellite mode.
 boolean isStreetView()
           
 boolean isTraffic()
           
protected  void onAttachedToWindow()
           
protected  void onDetachedFromWindow()
           
protected  void onDraw(android.graphics.Canvas canvas)
          Draws map and the overlays over the canvas.
 void onFocusChanged(boolean hasFocus, int direction, android.graphics.Rect unused)
           
 boolean onKeyDown(int keyCode, android.view.KeyEvent event)
          Listens for key events and calls the appropriate map operations
 boolean onKeyUp(int keyCode, android.view.KeyEvent event)
          Listens for key events and calls the appropriate map operations
protected  void onLayout(boolean changed, int l, int t, int r, int b)
          Layouts the child views based on the LayoutParams object.
protected  void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
           
 void onRestoreInstanceState(android.os.Bundle state)
          Restores the last saved map state
 void onSaveInstanceState(android.os.Bundle state)
          Saves current center and zoom level.
protected  void onSizeChanged(int w, int h, int oldw, int oldh)
          Resizes the MapView.
 boolean onTouchEvent(android.view.MotionEvent event)
          Dispatches the touch events to overlays and handle the appropriate map operations for touch events.
 boolean onTrackballEvent(android.view.MotionEvent event)
           
 void preLoad()
          Preloads the tiles for the current center point and zoom level
 void removeMapViewEventListener(MapView.MapViewEventListener eventListener)
          Removes a MapViewEventListener from the map
 void removeOverlayByKey(java.lang.String key)
          Removes the overlay by key
 void setBottomMargin(int bottomMargin)
          Sets the margin at bottom that must be applied
 void setBuiltInZoomControls(boolean on)
          Controls the visibility of built in zoom controls.
 void setFocalPoint(android.graphics.Point point)
          Sets any arbitrary point in the screen to be center of the map.
 void setLeftMargin(int leftMargin)
          Sets the margin at left that must be applied
 void setLoadingTile(android.graphics.Bitmap loadingTile)
          Set a custom background tile.
protected  void setMapCenter(GeoPoint geoPoint, int zoomLevel)
          Callers of this method need to issue their own events since they may differ in behavior, use map controller if you don't need custom events
 void setReticleDrawMode(MapView.ReticleDrawMode mode)
          Specifies how the reticle mode should be drawn.
 void setRightMargin(int rightMargin)
          Sets the margin at right that must be applied
 void setSatellite(boolean on)
          Sets the map to satellite mode with labels overlaid on top.
 void setStreetView(boolean on)
          Does nothing.
 void setTileLayerPaint(android.graphics.Paint paint)
          This allows you to specify a paint used while drawing tiles.
 void setTopMargin(int topMargin)
          Sets the margin at top that must be applied
 void setTraffic(boolean on)
          TODO -- move to traffic class
 
Methods inherited from class android.view.ViewGroup
addFocusables, addFocusables, addStatesFromChildren, addTouchables, addView, addView, addView, addView, addView, addViewInLayout, addViewInLayout, attachLayoutAnimationParameters, attachViewToParent, bringChildToFront, canAnimate, childDrawableStateChanged, cleanupLayoutState, clearChildFocus, clearDisappearingChildren, clearFocus, debug, detachAllViewsFromParent, detachViewFromParent, detachViewFromParent, detachViewsFromParent, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDraw, dispatchFreezeSelfOnly, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetPressed, dispatchSetSelected, dispatchThawSelfOnly, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowVisibilityChanged, drawableStateChanged, drawChild, findFocus, fitSystemWindows, focusableViewAvailable, focusSearch, gatherTransparentRegion, getChildAt, getChildCount, getChildDrawingOrder, getChildMeasureSpec, getChildStaticTransformation, getChildVisibleRect, getDescendantFocusability, getFocusedChild, getLayoutAnimation, getLayoutAnimationListener, getPersistentDrawingCache, hasFocus, hasFocusable, indexOfChild, invalidateChild, invalidateChildInParent, isAlwaysDrawnWithCacheEnabled, isAnimationCacheEnabled, isChildrenDrawingOrderEnabled, isChildrenDrawnWithCacheEnabled, measureChild, measureChildren, measureChildWithMargins, offsetDescendantRectToMyCoords, offsetRectIntoDescendantCoords, onAnimationEnd, onAnimationStart, onCreateDrawableState, onInterceptTouchEvent, onRequestFocusInDescendants, recomputeViewAttributes, removeAllViews, removeAllViewsInLayout, removeDetachedView, removeView, removeViewAt, removeViewInLayout, removeViews, removeViewsInLayout, requestChildFocus, requestChildRectangleOnScreen, requestDisallowInterceptTouchEvent, requestFocus, requestTransparentRegion, scheduleLayoutAnimation, setAddStatesFromChildren, setAlwaysDrawnWithCacheEnabled, setAnimationCacheEnabled, setChildrenDrawingCacheEnabled, setChildrenDrawingOrderEnabled, setChildrenDrawnWithCacheEnabled, setClipChildren, setClipToPadding, setDescendantFocusability, setLayoutAnimation, setLayoutAnimationListener, setOnHierarchyChangeListener, setPadding, setPersistentDrawingCache, setStaticTransformationsEnabled, showContextMenuForChild, startLayoutAnimation, updateViewLayout
 
Methods inherited from class android.view.View
awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, cancelLongPress, checkInputConnectionProxy, clearAnimation, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollOffset, computeVerticalScrollRange, createContextMenu, destroyDrawingCache, draw, findViewById, findViewWithTag, focusSearch, forceLayout, getAnimation, getApplicationWindowToken, getBackground, getBaseline, getBottom, getBottomFadingEdgeStrength, getBottomPaddingOffset, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFocusables, getFocusedRect, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getKeepScreenOn, getKeyDispatcherState, getLayoutParams, getLeft, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMeasuredHeight, getMeasuredWidth, getNextFocusDownId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getResources, getRight, getRightFadingEdgeStrength, getRightPaddingOffset, getRootView, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getTag, getTag, getTop, getTopFadingEdgeStrength, getTopPaddingOffset, getTouchables, getTouchDelegate, getVerticalFadingEdgeLength, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, invalidateDrawable, isClickable, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPaddingOffsetRequired, isPressed, isSaveEnabled, isScrollbarFadingEnabled, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onCheckIsTextEditor, onConfigurationChanged, onCreateContextMenu, onCreateInputConnection, onDisplayHint, onDrawScrollBars, onFinishInflate, onFinishTemporaryDetach, onKeyLongPress, onKeyMultiple, onKeyPreIme, onKeyShortcut, onRestoreInstanceState, onSaveInstanceState, onScrollChanged, onSetAlpha, onStartTemporaryDetach, onVisibilityChanged, onWindowFocusChanged, onWindowVisibilityChanged, performClick, performHapticFeedback, performHapticFeedback, performLongClick, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, refreshDrawableState, removeCallbacks, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEvent, sendAccessibilityEventUnchecked, setAnimation, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setEnabled, setFadingEdgeLength, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setId, setKeepScreenOn, setLayoutParams, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnFocusChangeListener, setOnKeyListener, setOnLongClickListener, setOnTouchListener, setPressed, setSaveEnabled, setScrollbarFadingEnabled, setScrollBarStyle, setScrollContainer, setSelected, setSoundEffectsEnabled, setTag, setTag, setTouchDelegate, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVisibility, setWillNotCacheDrawing, setWillNotDraw, showContextMenu, startAnimation, unscheduleDrawable, unscheduleDrawable, verifyDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface android.view.ViewParent
createContextMenu, getParent, isLayoutRequested, requestLayout
 

Constructor Detail

MapView

public MapView(android.content.Context context)
Initializes map objects with maps from MapQuest-OpenStreetMap tiles.

Parameters:
context -

MapView

public MapView(android.content.Context context,
               java.lang.String apiKey)
Initializes map objects with maps from MapQuest's licensed data.

Parameters:
context -

MapView

public MapView(android.content.Context context,
               android.util.AttributeSet attrs,
               int defStyle)
Initializes map objects with maps. If a valid android:apiKey is provided, uses MapQuest's licensed maps. Otherwise uses MapQuest-OpenStreetMap tiles.

Parameters:
context -
attrs - AttributeSet instance to read API key from android:apiKey
defStyle - The default style to apply to this view. If 0, no style will be applied (beyond what is included in the theme). This may either be an attribute resource, whose value will be retrieved from the current theme, or an explicit style resource.

MapView

public MapView(android.content.Context context,
               android.util.AttributeSet attrs)
Initializes map objects with maps. If valid android:apiKey is provided, uses MapQuest's licensed maps. Otherwise uses MapQuest-OpenStreetMap tiles.

Parameters:
context -
attrs - AttributeSet instance to read API key from android:apiKey
Method Detail

onSizeChanged

protected void onSizeChanged(int w,
                             int h,
                             int oldw,
                             int oldh)
Resizes the MapView. This super.onSizeChanged must be called if overridden.

Overrides:
onSizeChanged in class android.view.View

setMapCenter

protected void setMapCenter(GeoPoint geoPoint,
                            int zoomLevel)
Callers of this method need to issue their own events since they may differ in behavior, use map controller if you don't need custom events

Parameters:
geoPoint -
zoomLevel -

getFocalPoint

public android.graphics.Point getFocalPoint()
Returns the current point in the screen to which map is centered to.

Returns:
point in the screen

setFocalPoint

public void setFocalPoint(android.graphics.Point point)
Sets any arbitrary point in the screen to be center of the map.

Parameters:
point - point in the screen that map should center to.

preLoad

public void preLoad()
Preloads the tiles for the current center point and zoom level


getOverlayByKey

public Overlay getOverlayByKey(java.lang.String key)
Returns the overlay identified by the key

Parameters:
key - key value of the Overlay that must be returned
Returns:
null if Overlay not found for the given key

removeOverlayByKey

public void removeOverlayByKey(java.lang.String key)
Removes the overlay by key

Parameters:
key - key value of the Overlay that must be returned

getBoundingBox

public BoundingBox getBoundingBox(BoundingBox bbox)
Returns the bounding box of earth's region current shown in the map.

Returns:
BoundingBox

canCoverCenter

public boolean canCoverCenter()
Checks if the sufficient tiles are loaded to render center of the MapView


checkLayoutParams

protected boolean checkLayoutParams(android.view.ViewGroup.LayoutParams p)
Checks if p is instance of MapView.LayoutParams

Overrides:
checkLayoutParams in class android.view.ViewGroup
Returns:
true if p is instance of MapView.LayoutParams.

displayZoomControls

public void displayZoomControls(boolean takeFocus)
Bring the zoom control to front, if enabled and optionally sets the focus to zoom control.

Parameters:
takeFocus - if true sets the focus to zoom control.

generateDefaultLayoutParams

protected MapView.LayoutParams generateDefaultLayoutParams()
Generates the new MapView.LayoutParams object with default values.

Overrides:
generateDefaultLayoutParams in class android.view.ViewGroup

generateLayoutParams

public android.view.ViewGroup.LayoutParams generateLayoutParams(android.util.AttributeSet attrs)
Constructs the LayoutParam object from attribute set.

Overrides:
generateLayoutParams in class android.view.ViewGroup

generateLayoutParams

protected android.view.ViewGroup.LayoutParams generateLayoutParams(android.view.ViewGroup.LayoutParams p)
Constructs the new LayoutParam object from copying the layout values from the source p

Overrides:
generateLayoutParams in class android.view.ViewGroup

getController

public MapController getController()
Returns the MapController object which is used for pan and zoom operations.

Returns:
MapController instance attached to this MapView.

getLatitudeSpan

public int getLatitudeSpan()
Returns the MapView's latitude span in microdegrees

Returns:
the current latitude span in microdegrees

getLongitudeSpan

public int getLongitudeSpan()
Returns the MapView's longitude span in microdegrees

Returns:
the current longitude span in microdegrees

getOverlays

public java.util.List<Overlay> getOverlays()
Returns the overlay list object. Use this to add and remove overlays to/from MapView. The list is synchronized externally, however must be synchronized on the list instance if iterated.

Returns:
list containing the overlays.

getMapCenter

public GeoPoint getMapCenter()
Returns the center point of the MapView

Returns:
center of map

getMaxZoomLevel

public int getMaxZoomLevel()
Returns the maximum number of zoom levels the MapView supports NOTE: Currently this method is not accurate for Satellite maps. It returns a constant value that does not change based on map center.

Returns:
max zoom level

getProjection

public Projection getProjection()
Returns the projection class instance to convert GeoPoint to screen coordinates and vice versa.

Returns:
the projection instance.

getZoomLevel

public int getZoomLevel()
Returns the current zoom level of MapView.

Returns:
current zoom level

getZoomControls

public android.view.View getZoomControls()
Return the view to provide zoom in and out operations.

Returns:
zoom controls view

isSatellite

public boolean isSatellite()
Checks if the map is in satellite mode.

Returns:
isSatellite on

isStreetView

public boolean isStreetView()

isTraffic

public boolean isTraffic()

onAttachedToWindow

protected void onAttachedToWindow()
Overrides:
onAttachedToWindow in class android.view.View

onDetachedFromWindow

protected void onDetachedFromWindow()
Overrides:
onDetachedFromWindow in class android.view.View

getMapRotation

public float getMapRotation()

getMapWidth

public int getMapWidth()
Returns the map width required to fill the View. If map is rotated, returns auto adjusted the map width require to fill the view, otherwise returns the View.getWidth()

Returns:
current width of the map rendered in the screen

getMapHeight

public int getMapHeight()
Returns the map height required to fill the View. If map is rotated, returns auto adjusted the map height require to fill the view, otherwise returns the View.getHeight()

Returns:
current height of the map rendered in the screen

setTileLayerPaint

public void setTileLayerPaint(android.graphics.Paint paint)
This allows you to specify a paint used while drawing tiles. It was intended to use a color matrix filter to change the look of tiles on the fly. It only gets applied to MAP tiles not SAT or HYB. It will also setDither=true, setFilterBitmap=true and setAntiAlias=true when your paint object is passed in

Parameters:
paint -

onDraw

protected final void onDraw(android.graphics.Canvas canvas)
Draws map and the overlays over the canvas.

Overrides:
onDraw in class android.view.View

onLayout

protected void onLayout(boolean changed,
                        int l,
                        int t,
                        int r,
                        int b)
Layouts the child views based on the LayoutParams object.

Specified by:
onLayout in class android.view.ViewGroup

onMeasure

protected void onMeasure(int widthMeasureSpec,
                         int heightMeasureSpec)
Overrides:
onMeasure in class android.view.View

onFocusChanged

public void onFocusChanged(boolean hasFocus,
                           int direction,
                           android.graphics.Rect unused)
Overrides:
onFocusChanged in class android.view.View

onKeyDown

public boolean onKeyDown(int keyCode,
                         android.view.KeyEvent event)
Listens for key events and calls the appropriate map operations

Specified by:
onKeyDown in interface android.view.KeyEvent.Callback
Overrides:
onKeyDown in class android.view.View

onKeyUp

public boolean onKeyUp(int keyCode,
                       android.view.KeyEvent event)
Listens for key events and calls the appropriate map operations

Specified by:
onKeyUp in interface android.view.KeyEvent.Callback
Overrides:
onKeyUp in class android.view.View

onRestoreInstanceState

public void onRestoreInstanceState(android.os.Bundle state)
Restores the last saved map state

Parameters:
state -

onSaveInstanceState

public void onSaveInstanceState(android.os.Bundle state)
Saves current center and zoom level.

Parameters:
state -

onTouchEvent

public boolean onTouchEvent(android.view.MotionEvent event)
Dispatches the touch events to overlays and handle the appropriate map operations for touch events.

Overrides:
onTouchEvent in class android.view.View

onTrackballEvent

public boolean onTrackballEvent(android.view.MotionEvent event)
Overrides:
onTrackballEvent in class android.view.View

setBuiltInZoomControls

public void setBuiltInZoomControls(boolean on)
Controls the visibility of built in zoom controls.

Parameters:
on - if true, enables and shows the built in zoom control.

setReticleDrawMode

public void setReticleDrawMode(MapView.ReticleDrawMode mode)
Specifies how the reticle mode should be drawn.

Parameters:
mode - the reticle draw mode

setSatellite

public void setSatellite(boolean on)
Sets the map to satellite mode with labels overlaid on top.

Parameters:
on - if true, shows satellite images with labels on the view. If false, shows the

setStreetView

public void setStreetView(boolean on)
Does nothing.

Parameters:
on -

setTraffic

public void setTraffic(boolean on)
TODO -- move to traffic class

Parameters:
on -

destroy

public void destroy()
Cleans up the map objects, shutdowns the tile loading thread. Be sure to call MapView.destroy() if used outside of MapActivity or the method is overridden


setLoadingTile

public void setLoadingTile(android.graphics.Bitmap loadingTile)
Set a custom background tile. Should be a 256 pixel by 256 pixel image.

Parameters:
loadingTile -

clearTilesInMemory

public void clearTilesInMemory()
Clears the tile images currently loaded in the memory.


getTopMargin

public int getTopMargin()
Returns the margin at top currently applied

Returns:
the margin at top

setTopMargin

public void setTopMargin(int topMargin)
Sets the margin at top that must be applied

Parameters:
topMargin - the margin at top

getBottomMargin

public int getBottomMargin()
Returns the margin at bottom currently applied

Returns:
the margin at bottom

setBottomMargin

public void setBottomMargin(int bottomMargin)
Sets the margin at bottom that must be applied

Parameters:
bottomMargin - the margin at bottom

getRightMargin

public int getRightMargin()
Returns the margin at right currently applied

Returns:
the margin at right

setRightMargin

public void setRightMargin(int rightMargin)
Sets the margin at right that must be applied

Parameters:
rightMargin - the right at bottom

getLeftMargin

public int getLeftMargin()
Returns the margin at top currently applied

Returns:
the margin at top

setLeftMargin

public void setLeftMargin(int leftMargin)
Sets the margin at left that must be applied

Parameters:
leftMargin - the left at bottom

getConfiguration

public Configuration getConfiguration()
Get a handle on the configuration object used to configure optional items on the mapView

Returns:
configuration

addMapViewEventListener

public void addMapViewEventListener(MapView.MapViewEventListener eventListener)
Adds a MapViewEventListener to this mapView.

Parameters:
eventListener -

removeMapViewEventListener

public void removeMapViewEventListener(MapView.MapViewEventListener eventListener)
Removes a MapViewEventListener from the map

Parameters:
eventListener -