Hi,
I have checked out the example on how you load a custom tile package using Basemap class and setMap(). However, there's no indication on how you can load multiple Basemap class or ArcGISTiledLayer types
In the previous version of the runtime sdk (10.2.9), we can easily use Map.addLayer() to add layers, but I cannot find it anywhere on the MapView class on the latest sdk (I assume setMap() will just replace the previous one). We have quite a few of .tpk files stored in the device that we would want to display altogether
Is there anyway to load multiple tpk files? or is the feature not yet in the latest release?
Best regards,
Jason
Solved! Go to Solution.
If you just want to use them as basemap layers you could do something like this:
Basemap b = new Basemap();
b.getBaseLayers().addAll(layersCollection);
ArcGISMap arcGISMap = new ArcGISMap(b);
mapView.setMap(arcGISMap);
The layersCollection object would be of type Collection<? extends Layer> so you could create a list of layer objects and then load them into the basemap to then load into the mapview.
On the map object, use the getOperationalLayers() and then use add(Layer layer) to add a layer to the operational layers list of the Map that is set in the mapview.
ArcGISMap| arcgis-android <-- Should be bookmarked to the getOperationalLayers() method.
Hope this helps!
Thanks,
Alexander
Thank you for the response.
You actually need to give the map an instance of ArcGISMap first before accessing the map object from MapView.getMap() (It will be null originally if you don't provide a basemap through MapView.setMap()). Let's say we have 5 TPK files to be loaded. First thing to do is set the 1st TPK file inside the ArcGISMap object and add it using setMap() and then add the remaining 4 files as operational layers inside the ArcGISMap object (which contains the 1st TPK file). Is that how it works?
If you just want to use them as basemap layers you could do something like this:
Basemap b = new Basemap();
b.getBaseLayers().addAll(layersCollection);
ArcGISMap arcGISMap = new ArcGISMap(b);
mapView.setMap(arcGISMap);
The layersCollection object would be of type Collection<? extends Layer> so you could create a list of layer objects and then load them into the basemap to then load into the mapview.
oh very neat. Thank you very much
You're welcome!