AnsweredAssumed Answered

Layer Reordering

Question asked by steelis2013 on Aug 29, 2016
Latest reply on Sep 22, 2016 by ANohe-esristaff

Hi Everyone,


I am trying to use the order of the MapView.Layers to track the layer order in my program.


However, I realized that when I remove a layer from the MapView then subsequently adding the layer back, the layer in the operations will eventually become invisible. I have tried setting the layer opacity and visibility but the layer just does not appear. Even if I add additional Graphics to test the layer, the objects in the layer just does not appear. However, I can still find the layer and all the Graphics, even the recently added but still as invisible ones, when I debug the program at break points. Here is a section of the code that I have used for reordering of Layers.


if (actualToPosition >= 0 && fromPositionLayer instanceof GraphicsLayer) {
    GraphicsLayer graphicsLayer = (GraphicsLayer) fromPositionLayer;
    mapView.addLayer(graphicsLayer, actualToPosition);

Does anyone know if there's missing operation that I need to do for the MapView to "redraw" or "reload" a layer.


I have the other option of reassigning DrawOrder of each Graphic object in a layer instead of a remove and add but the operation seems too heavy when dealing with a heavily populated layer.


I could also reload the layer by serializing then de-serializing but it is again a very heavy operation.


If anyone have any alternatives that I am missing out at the moment, do let me know as well.


Thanks in advance for any help.


Edit: I realized that if I perform the 3 operations again after I pinch to zoom, the Graphics will reappear.


Android 6.0.1

Esri 10.2.8-1