I have the following code implemented but it doesnt work like I want:
My onSaveInstanceState and restore:
@Override
public void onSaveInstanceState(Bundle savedInstanceState) {
super.onSaveInstanceState(savedInstanceState);
savedInstanceState.putIntArray("ColorArray", colorArraySave);
}
@Override
public void onRestoreInstanceState(Bundle savedInstanceState) {
super.onRestoreInstanceState(savedInstanceState);
colorArraySave = savedInstanceState.getIntArray("ColorArray");
}
My onStop, onResume, onPause methods:
@Override
protected void onPause() {
super.onPause();
saveGridViewColor(colorArraySave);
}
@Override
protected void onStop() {
super.onStop();
saveGridViewColor(colorArraySave);
}
@Override
protected void onResume() {
super.onResume();
colorTheGridView(colorArraySave);
}
So I have an int array that I want to save if the activity is stopped/closed and load back instanly if the activity is called again but the code I use doesnt work.
- saveGridViewColor() is saving the int[] array to colorArraySave
- colorTheGridView() is coloring the gridview items via an int array.
Any ideas how can I get this working?