Creating a Graphics Layer
Graphics layers allow you to dynamically display graphics on a Map. A Graphics layer could, for example, be used to hold polygons or lines drawn by a user or display features that satisfy the results of a task such as query or geoprocessing. The GraphicsLayer class allows you to create a layer that can contain one or more Graphic features.
Add a Graphic Layer
The API exposes 2 public constructors, one for an empty GraphicsLayer and one which allows you to set the spatial reference and full extent of the layer. Be aware that the empty constructor assumes you have a base layer defined for the MapView as the GraphicsLayer cannot be the bottom most layer. Once you have created a GraphicsLayer you add it to the map with the MapView.addLayer() method as shown below:
The API exposes 2 public constructors, one for an empty GraphicsLayer and one which allows you to set the spatial reference and full extent of the layer. Be aware that the empty constructor assumes you have a base layer defined for the MapView as the GraphicsLayer cannot be the bottom most layer. Once you have created a GraphicsLayer you add it to the map with the MapView.addLayer() method as shown below:
// Inflate Mapview from XML
MapView mMapView = (MapView)findViewById(R.id.map);
...
// Create GraphicsLayer
GraphicsLayer gLayer = new GraphicsLayer();
// Add basemap layer first
mMapView.addLayer(basemap);
// Add empty Graphics Layer
mMapView.addLayer(gLayer);
A MapView can contain one or many GraphicLayers. Adding Graphics to your Graphics Layer is described in Managing Graphic Features document