i deploy a mxd file on arcgis server which contains 4 layers ,such as l1,l2,l3,l4code below could display the map correctly:
ArcGISDynamicMapServiceLayer ams = new ArcGISDynamicMapServiceLayer(SERVER_URL);
mMapView.addLayer(ams);
SERVER_URL is the mxd map service urlnow 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 l3i don't know how to dealing with such requirementi get all layers using the method ams.getLayers(), loop the layers and setVisible(false),but itdoes'nt work,i don't konw why