2

How do you save the map and overlay state when some other application or activity comes to the foreground or user clicks the home button? Typically, when the activity displays again the itemized overlay items are not longer present on the map.

deepwinter
  • 4,568
  • 2
  • 31
  • 37

1 Answers1

0

According to this link http://www.androiddiscuss.com/1-android-discuss/37923.html one of the commonly suggested solutions to avoiding the need to completely reconstruct your overlays is to have them implement the Parceable interface and then store/restore them from the bundle during onRetainInstanceState and onCreate.

This will depend on your implementation of ItemizedOverlay. On possible solution might be to store just the saved overlay item in the bundle, and then call a special constructor onCreate if you have that data available.

Another solution is just to re-run whatever function you have implemented to populate the itemized overlay. Keep in mind that when an activity is destroyed it looses its state completely. The itemized overlay is part of that state, so unless you save or rebuild it, it won't be there when the activity is relaunched.

deepwinter
  • 4,568
  • 2
  • 31
  • 37