| Issue 4912: | Bug: State loss because MapView does not override View.onSaveInstanceState() | |
| 33 people starred this issue and may be notified of changes. | Back to list |
MapView does not override "public Parcelable View.onSaveInstanceState()" (not to be messed up with lifecycle method onSaveInstanceState(Bundle outState)) and therefore looses its state in situations that rely on this mechanism. Example: The FragmentManager saves state of the view hierachy (including all views which have IDs) when a fragment is detached to be able to restore it later when the fragment is beeing re-attached. Lifecylce method onSaveInstanceState(Bundle outState) is *not* called in this case. As MapView does not override View.onSaveInstanceState(), its state is not saved which leads to an uninitialized (completely zoomed out and centered at (0,0)) map after re-attaching the fragment. As a consequence, MapView cannot be used inside custom fragments which are detached / re-attached. However, this is badly needed, e.g. when working with ActionBar tabs. As tab contents itself are typically fragments and we cannot have nested fragments prior API Level 17, we have to define a fragment containing some other view elements and a MapView. ********************************************************* For developers viewing this issue: please click the 'star' icon to be notified of future changes, and to let us know how many of you are interested in seeing it resolved. *********************************************************
Feb 11, 2013
#1
[email protected]
Feb 11, 2013
Thanks for the bug report. As a workaround, could you try using SupportMapFragment and Android's Support Library?
Status:
Confirmed
Labels: Internal-8176805
May 20, 2014
I have also experienced this bug, however I have found no way to use SupportMapFragment when placing the map inside of a Fragment
May 25, 2016
Is a fix planned? |
|
| ► Sign in to add a comment |