sdk-maps / com.tomtom.online.sdk.map / MapView

MapView

open class MapView : FrameLayout, UiComponentsLayer, UIMapSettings, SnapshotService

A view used to display a map. When you want to use this view directly, you need to pass forward all life cycle methods to this class (e.g., onPause, onResume).

Constructors

<init>

MapView(context: Context)

Default constructor that uses context to inflate a view and create the map database. Constructor also creates TomtomMap with the default configuration.

MapView(context: Context, styleUrl: String)

Custom constructor to provide custom style url. Custom style url can be pass from http server or application assets.

MapView(context: Context, attrs: AttributeSet?)

Custom constructor to provide custom set of attributes.

MapView(context: Context, keys: MutableMap<String!, String!>!)

Custom constructor to provide online API keys dynamically. Keys provided within the map will override any keys set in the AndroidManifest.xml Constructor also creates TomtomMap with default configuration.

MapView(context: Context, keys: MutableMap<String!, String!>!, styleUrl: String)
MapView(context: Context, mapProperties: MapProperties!)

Custom constructor to provide online API keys dynamically together with a custom style url. Custom style url can be pass from http server or application assets.

MapView(context: Context, attrs: AttributeSet?, defStyleAttr: Int)

Custom constructor to provide custom set of attributes and a reference to default style resource.

Functions

addOnMapReadyCallback

open fun addOnMapReadyCallback(callback: OnMapReadyCallback!): Unit

Register OnMapReadyCallback callback used to inform that the map view is ready to be used.

createGpsIndicator

open fun createGpsIndicator(): Unit

createMap

open fun createMap(nativeMapView: NativeMapView!): Unit

createMapDatabase

open fun createMapDatabase(context: Context!): Unit

createSnapshotter

open fun createSnapshotter(): Unit

forceDestroy

open fun forceDestroy(): Unit

Force the map to destroy the surface view and renderer. Once called, no map operations are available anymore. This method should be linked with lifecycle, it is internally used by onDestroy.

getCompassView

open fun getCompassView(): CompassView!

getCopyrightsView

open fun getCopyrightsView(): CopyrightsView!

getCurrentLocationView

open fun getCurrentLocationView(): CurrentLocationView!

getLogoView

open fun getLogoView(): LogoView!

getMapChangeListener

open fun getMapChangeListener(): TomtomMapCallback.OnMapChangedListener!

For test only.

getMarkerBalloonsLayerView

open fun getMarkerBalloonsLayerView(): ViewGroup!

getPanningControlsView

open fun getPanningControlsView(): PanningControlsView!

getZoomingControlsView

open fun getZoomingControlsView(): ZoomingControlsView!

init

open fun init(context: Context!): Unit

initView

open fun initView(): Unit

loadDefaultStyle

open fun loadDefaultStyle(): Unit

onDestroy

open fun onDestroy(): Unit

You must call this method from the parent Activity/Fragment's corresponding method. When the map is going to be recreated (e.g., onSaveInstanceState was called), there will be no action executed. Otherwise, the native part will be removed and map state will be removed.

onHostSaveInstanceState

open fun onHostSaveInstanceState(): Unit

You must call this method from the method responsible for the saving of the stated hosting components, e.g., android.app.Activity#onSaveInstanceState(Bundle) or androidx.fragment.app.Fragment#onSaveInstanceState(Bundle). It's determined when MapView will be recreated and the native part will be not destroyed when onDestroy() will be called.

onPause

open fun onPause(): Unit

You must call this method from the parent Activity/Fragment's corresponding method.

onRestoreInstanceState

open fun onRestoreInstanceState(state: Parcelable!): Unit

onResume

open fun onResume(): Unit

You must call this method from the parent Activity/Fragment's corresponding lifecycle method.

onSaveInstanceState

open fun onSaveInstanceState(): Parcelable?

onStart

open fun onStart(): Unit

You must call this method from the parent Activity/Fragment's corresponding lifecycle method.

onStop

open fun onStop(): Unit

You must call this method from the parent Activity/Fragment's corresponding method.

onTouchEvent

open fun onTouchEvent(event: MotionEvent!): Boolean

parseAttrs

open fun parseAttrs(context: Context!, attrs: AttributeSet!): Unit

setSnapshotter

open fun setSnapshotter(snapshotter: Snapshotter): Unit

Method that allows you to change an implementation of Snapshotter.

setStyleJson

open fun setStyleJson(styleJson: String!): Unit
open fun setStyleJson(styleJson: String!, layerSetConfiguration: LayerSetConfiguration!): Unit

setStyleUrl

open fun setStyleUrl(styleUrl: String!): Unit
open fun setStyleUrl(styleUrl: String!, layerSetConfiguration: LayerSetConfiguration!): Unit

setZOrderMediaOverlay

open fun setZOrderMediaOverlay(zOrderOnTop: Boolean): Unit

Control whether the map surface view's surface is placed on top of another regular surface view in the window (but still behind the window itself). This is typically used to place mini map on top of an underlying map surface view.

takeSnapshot

open fun takeSnapshot(callback: SnapshotCallback): Unit

Take a snapshot of a Map. The result will be delivered by SnapshotCallback.

updateMapConfig

open fun updateMapConfig(holder: SurfaceHolder!): Unit

updateMapSurface

open fun updateMapSurface(holder: SurfaceHolder!): Unit

verifyGpsStatus

open fun verifyGpsStatus(): Unit