AnsweredAssumed Answered

Visible Layers in a DynamicMapServiceLayer

Question asked by watershed.web.mapping on Jul 14, 2012
Latest reply on Dec 16, 2013 by lookicloud
Hello Everyone,

I have the following layer,

ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer(my_map_server_url);

And i know i can add a int array to the constructor to decide which layers are visible in the following way:

ArcGISDynamicMapServiceLayer layer = new ArcGISDynamicMapServiceLayer(my_map_server_url,new int[] {0,1,2});

but can I change the visible layers programmatically?
For example I would like to have a button where the user can select which layer to see.

How can I achieve this?