anderolujun

dealing with layers of ArcGISDynamicMapServiceLayer

Discussion created by anderolujun on Aug 13, 2012
Latest reply on Sep 25, 2012 by rjhauck
i deploy a mxd file on arcgis server which contains 4 layers ,such as l1,l2,l3,l4
code below could display the map correctly:
ArcGISDynamicMapServiceLayer ams = new ArcGISDynamicMapServiceLayer(SERVER_URL);
mMapView.addLayer(ams);

SERVER_URL is the mxd map service url

now i have new requirements ,in some conditions,it need display the map with l1,l2 and l4.
in other conditions, the map should only contains l1,l2 and l3
i don't know how to dealing with such requirement

i get all layers using the method ams.getLayers(), loop the layers  and setVisible(false),but it
does'nt work,i don't konw why

Outcomes