Select to view content in your preferred language

Using MapView in a Fragment redownload tiles

2034
2
02-10-2016 03:20 AM
CesarRevilla
Regular Contributor

Hi, im using a Fragment to show the MapView. I do this because the "device configuration changed" event destroy the MainActivity and I don't want to recreate the wohle App Objects after this event.

The new created MainActivity (after the "device configuration changed" event ) can fetch the old Fragment with the MapView, but the original MapView cant be showed in the new Activity. Its needed to create a new MapView (with a new context) and return a new View for the new Activity. Unfortunately the new MapView needs redownload all tiles. Can this behavior be avoided? Can the old MapView object be used with the new Activity?

Regards,

Cesar

0 Kudos
2 Replies
ShellyGill1
Esri Contributor

Hi Cesar,

There's a help topic that discusses a few options for exactly this situation - Handle device configuration changes—ArcGIS Runtime SDK for Android | ArcGIS for Developers  .

Looks like you probably want to choose between options 1 and 2, depending on your specific requirements and what your app is doing.

Hope this helps,

Shelly

CesarRevilla
Regular Contributor

I think all this solutions are not helpful.

Option 1. You can pass all variables between two Activities, but the MapView restarts and all the connected layers reloads the Data. I can't prevent the reload of data in the MapView, I can set the same center, the same leve, the same renderer, etc. as before, but all will reload.

Option 2. You can block some restarts with this line, but not all, e.g. Low Memory.

Best Regards and thanks,

Cesar

0 Kudos