Maps

Routing & Navigation

Search

Add Layer

This sample shows how to add a tiled map service as a basemap and a dynamic map service as a map overlay layer.

Features

ArcGISTiledMapServiceLayer

ArcGISDynamicMapServiceLayer

Sample Design

The sample is a simple illustration on how to toggle the visibility of a map layer using a long press gesture. The MapView and it's initial extent are created inside a LinearLayout which gets inflated in the onCreate() method. The Tiled service basemap and the Dynamic US Streets overlay layer get added to the MapView with the addLayer() method on start of the application. The MapView.setOnPressListener() method is where the logic is to toggle the visibility of the Dynamic US Streets overlay layer. It first checks that the MapView is loaded and if so does a secondary check to confirm dynamic layer is not null. If the app passes both checks the layers visibility is toggled through the ArcGISDynamicMapServiceLayer.setVisibility() method.