Select to view content in your preferred language

(Android) ArcGISDynamicMapServiceLayer don't have setVisibleLayers method

3033
3
12-15-2015 06:46 PM
sankira
Deactivated User

Hi all, I try to set visibility for a subLayer set of an  ArcGISDynamicMapServiceLayer, but I'm not see setVisibleLayers method. I have tried with constructor as  : ArcGISDynamicMapServiceLayer mylayer = new ArcGISDynamicMapServiceLayer(myurl, new int[]{1,2,3} ) but it not work . Please help me if you know . Thank all

Tags (1)
0 Kudos
3 Replies
EricBader
Honored Contributor

On the ArcGISDynamicMapServiceLayer, I think you can call getLayers(), which returns a collection of  ArcGISLayerInfos for the sub-layers in that service. ArcGISLayerInfo has setVisible(bool) that you can call. Is this what you're asking for?

0 Kudos
sankira
Deactivated User

Thank Eric for your answer, I have tried with that solution but still not work , all sub-layer still display :

layer.setVisible(true);

ArcGISLayerInfo[] lis = layer.getAllLayers();

for(ArcGISLayerInfo info : lis){

         if(info.getId() == 10){

                 info.setVisible(true);

          }else{

                   info.setVisible(false);

          }

  }

0 Kudos
CatalinBrad
Emerging Contributor

After this command info.setVisible(true); you have to refresh the MapView object. The only way I found to make it work was mapView.ZoomIn; followed by mapView.ZoomOut;

the same method for info.setVisible(false);

0 Kudos