Created
March 16, 2020 16:14
-
-
Save Pluu/7b7a7c38064bba967754e5fe4334ba5d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public final class SavedStateHandle { | |
static SavedStateHandle createHandle(@Nullable Bundle restoredState, | |
@Nullable Bundle defaultState) { | |
... | |
Map<String, Object> state = new HashMap<>(); | |
if (defaultState != null) { | |
for (String key : defaultState.keySet()) { | |
state.put(key, defaultState.get(key)); | |
} | |
} | |
... | |
ArrayList keys = restoredState.getParcelableArrayList(KEYS); | |
ArrayList values = restoredState.getParcelableArrayList(VALUES); | |
... | |
for (int i = 0; i < keys.size(); i++) { | |
state.put((String) keys.get(i), values.get(i)); | |
} | |
return new SavedStateHandle(state); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment