Skip to content
This repository was archived by the owner on Aug 8, 2023. It is now read-only.
This repository was archived by the owner on Aug 8, 2023. It is now read-only.

Check if savedInstanceState bundle contains MapView keys #2816

Closed

Description

@tobrun

To make the MapView class a bit more robust, we should check if the bundle from onCreate contains any MapView keys before trying to load them. This will prevent the app from crashing as in #2801 and will result in ignoring saved state in case that the end developer has not called the onSaveInstanceState method.

Activity

  1. added
    Android
    on Oct 27, 2015
  2. added this to the android-v2.2.0 milestone on Oct 27, 2015
  3. ljbade commented on Oct 27, 2015

    @ljbade
    Contributor

    The bundle functions do allow a default value for missing keys. I am going to look at this.

  4. tobrun commented on Oct 28, 2015

    @tobrun
    MemberAuthor

    yeah, but you can't cover all the use cases. If the end developer doesn't override onsaveinstancestate we should just ignore the whole block by checking if bundle contains certain keys.

  5. ljbade commented on Oct 28, 2015

    @ljbade
    Contributor

    @tobrun True. I am thinking we stash a magic key/value and check we get the same value back.

  6. modified the milestones: android-v2.3.0, on Dec 4, 2015
  7. tobrun commented on Feb 17, 2016

    @tobrun
    MemberAuthor

    I'm adding:

            outState.putBoolean(MapboxConstants.STATE_HAS_SAVED_STATE, true);

    to be able to check this in onCreate:

            if (savedInstanceState != null && savedInstanceState.getBoolean(MapboxConstants.STATE_HAS_SAVED_STATE)) {
  8. added a commit that references this issue on Feb 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Android

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions