chris.bass

GraphicsLayer not drawing between Activities

Discussion created by chris.bass on Feb 27, 2012
I have a single map in an activity in my application.  On the map are two buttons, one begins a selection while the other switches to another activity.

I have finally gotten the map to redraw my selection graphic layer when changing the layout from portrait to landscape.  Unfortunately I have been unable to get them to redraw when going from the non-map activity that just contains a single button to return to the map activity.  I have tried many different things to get this to work including removing, reinitializing and readding the graphics layer in the onCreate but each time it will not draw.

I tried adding the following code to my map activity as per a suggestion I read:
 @Override 
 protected void onDestroy() { 
  super.onDestroy();
  MapView map = (MapView) findViewById(R.id.map);
  map.recycle();
 }
 @Override
 protected void onPause() {
  super.onPause();
  MapView map = (MapView) findViewById(R.id.map);
  map.pause();
 }
 @Override  protected void onResume() {
  super.onResume(); 
  MapView map = (MapView) findViewById(R.id.map);
  map.unpause();
 }


This issue affects both the selection layer and the layer that is drawn to represent a selection box.  I followed the example code for both of these.

Thanks for any help anyone has on this issue.

Outcomes