App state remains consistent only when plugged into USB but not on emulator
-
19-10-2022 - |
Domanda
I'm pretty confused as to why this is. When I close and open my app on my phone without killing the process, it reopens as if it was never open to begin with. If I continue to use the app that was sent via USB debugging after disconnecting the cable, it works fine. If I grab the APK from the bin folder and install that, it will break.
This is my code for saving my variables in the onSaveInstanceState method:
super.onSaveInstanceState(outState);
outState.putParcelableArrayList(PAIRS, pairs);
outState.putStringArrayList(PLAYERS, players);
outState.putParcelableArray(TEAMS_IN, teamsIn);
outState.putSerializable(GAMES_OUT, gamesOut);
outState.putStringArrayList(CURRENTLY_PLAYING, currentlyPlaying);
And this is the code that runs in onCreate if savedInstanceState != null:
pairs = savedInstanceState.getParcelableArrayList(PAIRS); //TODO: look into type
players = savedInstanceState.getStringArrayList(PLAYERS);
teamsIn = (Team[]) savedInstanceState.getParcelableArray(TEAMS_IN);
gamesOut = (HashMap<String, Integer>) savedInstanceState.getSerializable(GAMES_OUT);
currentlyPlaying = (ArrayList<String>) savedInstanceState.getStringArrayList(CURRENTLY_PLAYING);
What could possibly be causing this?
Nessuna soluzione corretta
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow