Hello guys,
I am trying fetch sublayer from WmsLayer for visible and invisible those layers . but problem is when i am using this code "this.layer.getSublayers().get(0).setVisible(this.visible);" and run the code I am getting bound exception "Index 0 out of bounds for length 0". and i am debugging this code i get the value of sublayer list as Null. can anybody help how to i am able to get sublayer from Wmslayer? what is the wrong in my code?
Hi,
Try loading the WmsLayer before calling getSublayers(), for example:
WmsLayer wmsLayer = new WmsLayer(url, layerNames);assertEquals(0, wmsLayer.getSublayers().size());wmsLayer.loadAsync();
mWmsLayer.addDoneLoadingListener(() -> { if (wmsLayer.getLoadStatus() == LoadStatus.LOADED) { assertTrue(wmsLayer.getSublayers().size() > 0);
}});
Angemeldete Mitglieder können Beiträge verfassen, Updates folgen und mehr. Neu hier? Registriere ein kostenloses Konto.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.