public class

MapView

extends FrameLayout
java.lang.Object
   ↳ android.view.View
     ↳ android.view.ViewGroup
       ↳ android.widget.FrameLayout
         ↳ com.amazon.geo.mapsv2.MapView

Class Overview

Represents a View for displaying a map.

Life cycle events of the parent Activity or Fragment must be forwarded to the View by calling the corresponding methods in this class:

  1. onCreate(Bundle)
  2. onResume()
  3. onPause()
  4. onDestroy()
  5. onSaveInstanceState(Bundle)
  6. onLowMemory()

For automatic life cycle management, use a MapFragment instead.

Summary

[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)
Creates a new MapView object.
MapView(Context context, AttributeSet attrs)
Creates a new MapView object with specified attributes.
MapView(Context context, AttributeSet attrs, int defStyle)
Creates a new MapView object with the specified attributes and default style.
MapView(Context context, AmazonMapOptions options)
Creates a new MapView object with the specified map options.
Public Methods
final AmazonMap getMap()
This method is deprecated. Use getMapAsync(OnMapReadyCallback) instead. The callback of that method provides an AmazonMap which is guaranteed to be non-null.
final void getMapAsync(OnMapReadyCallback callback)
Get an AmazonMap asynchronously with a callback after it is ready to be used.
final void onCreate(Bundle savedInstanceState)
This method must be called from the corresponding Activity or Fragment method.
final void onDestroy()
This method must be called from the corresponding Activity or Fragment method.
final void onLowMemory()
This method must be called from the corresponding Activity or Fragment method.
final void onPause()
This method must be called from the corresponding Activity or Fragment method.
final void onResume()
This method must be called from the corresponding Activity or Fragment method.
final void onSaveInstanceState(Bundle outState)
This method must be called from the corresponding Activity or Fragment method.
[Expand]
Inherited Methods
From class android.widget.FrameLayout
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)

Creates a new MapView object.

Parameters
context The app Context.

public MapView (Context context, AttributeSet attrs)

Creates a new MapView object with specified attributes.

Parameters
context The app Context.
attrs An AttributeSet containing the attributes for the MapView.

public MapView (Context context, AttributeSet attrs, int defStyle)

Creates a new MapView object with the specified attributes and default style.

Parameters
context The app Context.
attrs An AttributeSet containing the attributes for the MapView.
defStyle The default style to apply to the view.

public MapView (Context context, AmazonMapOptions options)

Creates a new MapView object with the specified map options.

Parameters
context The app Context.
options An AmazonMapOptions object with the desired initial map options.

Public Methods

public final AmazonMap getMap ()

This method is deprecated.
Use getMapAsync(OnMapReadyCallback) instead. The callback of that method provides an AmazonMap which is guaranteed to be non-null.

Gets the map object associated with this MapView.

This method returns null if the map is not yet initialized through onCreate(Bundle). Subsequent calls can return a valid AmazonMap object once the map is initialized.

This method also returns null if the Amazon Maps API library is not available on the device.

Returns
  • The AmazonMap object for the map displayed in the MapView. Returns null if the map has not been initialized or if the Amazon Maps API library is not available.

public final void getMapAsync (OnMapReadyCallback callback)

Get an AmazonMap asynchronously with a callback after it is ready to be used. The map provided to the callback is guaranteed to be non-null.

This method must be called from the main thread. The callback will be invoked on the main thread.

Parameters
callback The callback to invoke when the map is ready to use.

public final void onCreate (Bundle savedInstanceState)

This method must be called from the corresponding Activity or Fragment method.

public final void onDestroy ()

This method must be called from the corresponding Activity or Fragment method.

public final void onLowMemory ()

This method must be called from the corresponding Activity or Fragment method.

public final void onPause ()

This method must be called from the corresponding Activity or Fragment method.

public final void onResume ()

This method must be called from the corresponding Activity or Fragment method.

public final void onSaveInstanceState (Bundle outState)

This method must be called from the corresponding Activity or Fragment method.