I'm making an android game with levels. I made a Button[][] Array which every Button has setEnabled(false) exept the first one which has been set true due to allow players to start the game and "unlock" other levels. I stored a global Boolean Array with the button enabling state so that every time i enter the "LevelsActivity" i can read the Boolean array and update the buttons states. And all of this works fine.
My question is about how to save this Boolean array so that i can load it after the app closing.
I read about SharedPreferences and i find out some code but i can't implement to my purpose. Furthermore i read that array aren't supported by SharedPreferences and i should convert the array to string but i still can't do it. Thanks in advance
This is my Global class if it could help:
public class Globals extends Application {
private boolean[] array = new boolean[125];
public Globals() {
for (int i = 0; i < 125; i++) {
array[i] = false;
}
array[0] = true;
}
public boolean getData(int i){
return this.array[i];
}
public void setData(int i, boolean value){
this.array[i]=value;
}
}