0
我試圖用於存儲數據的Android Application
類(MyApplication.java)在字符串的一些ArrayList
S和int
小號應用程序類可用於存儲數據? (持久性數據)
我想這些數據得到真實永遠保存,如數據庫,但不使用數據庫,以簡化我的應用程序。
當我退出應用程序時,僅當應用程序的進程仍處於後臺時,纔會存儲數據。但是,如果我殺了應用程序的進程,MyApplication.java類中存儲的數據將被刪除。
有辦法解決這個問題嗎?
代碼恢復:
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"
有一種方法來存儲變量格式? (arraylist,array [] []等.. ??????我需要做它沒有數據庫 – NullPointerException
看看[ObjectInputStream](http://developer.android.com/reference/java/io/ ObjectInputStream.html)和[ObjectOutputStream](http://developer.android.com/reference/java/io/ObjectOutputStream.html)。只要您保存的所有內容都可以被序列化,這些工作就會起作用。 –