I'm trying to use Android Application
class (MyApplication.java) for store data in some ArrayList
s of strings and int
s
I want that these data get's stored forever, like a database, but without using databases, to simplify my app.
Currently the data get's stored when I exit of the app only when the process of the app is still on background. But if i kill the process of the app, the 开发者_StackOverflow中文版data stored on MyApplication.java class get's removed.
There is a way to solve this?
Code resumed:
public class MyApplication extends Application {
public static String LeagueTable[][] = new String[21][8];
//COLUMNAS MATRIZ:
//0 /1 /2 /3 /4 /5 /6 /7
//nombre/P.J./P.G./P.E./P.P./G.F./G.C./Pts
public static League LFP = new League();
public static Category Primera = new Category(20);
public static int NEQUIPOS=20;
public static int[][] matriz= new int[NEQUIPOS+1][NEQUIPOS+1]; //esta es la matriz de emparejamientos, representa el calendario
public static int PlayerTeamID;
public static boolean ExistingSaveGame=false;//esto es true cuando existe una partida guardada
//variables candidatas a poner dentro de una de las clases del modelo, como season por ejemplo
public static int RoundNumber; //jornada actual
public static boolean SeasonOver=false;//true cuando la temporada ha terminado
public void onCreate() {
super.onCreate();
}
public void onTerminate() {
super.onTerminate();
}
"and a lot of functions that works with the static variables"
No it can not. If you don't store your data in storage (that doesn't need to be a db, could be a flat file or whatever) then it is not persistent.
精彩评论