AnsweredAssumed Answered

Not able to remove feature layer in android sdk

Question asked by cyber2maro on Jul 31, 2018

hello all,

 

in my app im trying to remove some layers at some point,whatever i try,the layers are not getting removed ..

 

i have tried the default mapview.removeLayer(layerName);

 

but it didnt work..

 

i even tried to loop through all the layers and manually remove the layer with the following code..still no hope 

 

 

public static void removeLayerByName(String layerName, Layer[] layers) {
    if (layerName != null) {
        for (Layer item : layers) {
            if (item instanceof POIFeatureLayer) {
                if (item.getName() != null) {
                    if (item.getName().equals(layerName)) {
                        ((POIFeatureLayer) item).removeAll();
                    }
                }
            }
        }
    }
}

please help regarding this

Outcomes