Google is committed to advancing racial equity for Black communities. See how.

MapView

public class MapView extends FrameLayout

A View which displays a map (with data obtained from the Google Maps service). When focused, it will capture keypresses and touch gestures to move the map.

Users of this class must forward all the life cycle methods from the Activity or Fragment containing this view to the corresponding ones in this class. In particular, you must forward on the following methods:

A GoogleMap must be acquired using getMapAsync(OnMapReadyCallback). The MapView automatically initializes the maps system and the view.

For a simpler method of displaying a Map use MapFragment (or SupportMapFragment) if you are looking to target earlier platforms.

Note: You are advised not to add children to this view.

Developer Guide

For more information, read the Google Maps SDK for Android developer guide.

Inherited Constant Summary

Inherited Field Summary

Public Constructor Summary

MapView(Context context)
MapView(Context context, AttributeSet attrs)
MapView(Context context, AttributeSet attrs, int defStyle)
MapView(Context context, GoogleMapOptions options)
Constructs MapView with GoogleMapOptions.

Public Method Summary

void
getMapAsync(OnMapReadyCallback callback)
Returns a instance of the GoogleMap through the callback, ready to be used.
void
onCreate(Bundle savedInstanceState)
You must call this method from the parent Activity/Fragment's corresponding method.
void
onDestroy()
You must call this method from the parent Activity/Fragment's corresponding method.
void
onEnterAmbient(Bundle ambientDetails)
You must call this method from the parent WearableActivity's corresponding method.
void
onExitAmbient()
You must call this method from the parent WearableActivity's corresponding method.
void
onLowMemory()
You must call this method from the parent Activity/Fragment's corresponding method.
void
onPause()
You must call this method from the parent Activity/Fragment's corresponding method.
void
onResume()
You must call this method from the parent Activity/Fragment's corresponding method.
void
onSaveInstanceState(Bundle outState)
You must call this method from the parent Activity/Fragment's corresponding method.
void
onStart()
You must call this method from the parent Activity/Fragment's corresponding method.
void
onStop()
You must call this method from the parent Activity/Fragment's corresponding method.

Inherited Method Summary