Select to view content in your preferred language

GraphicsLayer problem

2313
0
01-30-2014 12:06 PM
JoeRadjavitch
New Contributor
Hello,

I am having a problem with my GraphicsLayer. I open a MapView and add a graphic when the user taps the map.
There is also functionality to change the base map. If the user stays on the initial base map, the graphics display properly.

However, if the user changes the base map, the graphics are not displayed. I put a breakpoint in my code to verify the graphics still exist in the layer and the layer is still in the map (it is the last layer in the map).

Here is my reorder code:

 private void orderArcmap(Boolean isChangeBase) {

  int startPoint;
  
  if (isChangeBase) {
   arcMap.removeAll();
   startPoint = 0;
  } else {
   while (arcMap.getLayers().length > 1) {
    arcMap.removeLayer(arcMap.getLayers().length - 1);
   }

   startPoint = 1;
  }

  for (int i = startPoint; i < 4; i++) {
   for (Map.Entry<Layer, Integer> entry : layerMap.entrySet()) {
    if (entry.getValue() == i) {
     arcMap.addLayer(entry.getKey());
    }
   }
  }

  arcMap.addLayer(arcGisGraphicLayers);
  arcMap.refreshDrawableState();
  arcMap.postInvalidate();
 }


Any ideas where I should look to fix my problem?

Thanks,
JR
0 Kudos
0 Replies