CartoDB / mobile-sdk

CARTO Mobile SDK core project
https://carto.com/docs/carto-engine/mobile-sdk/
BSD 3-Clause "New" or "Revised" License
179 stars 65 forks source link

Sharing MapView between Activities/Fragments or View Controller #517

Open lasyakoechlin opened 1 year ago

lasyakoechlin commented 1 year ago

Is there a way that we can take the already initialized MapView UI and simply re-apply it to a new fragment or View Controller?

It seems to be slow to constantly re-initialize the map for every Fragment.

One option is to just have a single Activity and put the MapView on that level; However, in some cases, where having separate Activities is desired, I would like to maintain the MapView state and not need to continuously go through the initialization process.

Any suggestions would be greatly appreciated.

mtehver commented 1 year ago

Currently there is no simple way to move contents from one MapView to another - namely, Layer instances are associated with MapView instances and SDK does not support moving layers between MapView instances.

But lower level objects, like various services and data sources can be shared between multiple MapView instances.