i have this class:
public class SaveState implements Serializable {
private static final long serialVersionUID = 1L;
public List<String> downloadedMagazinesIds = new ArrayList<String>();//id's de
revistas descargadas
public List<String> downloadedMagazinesSummaries = new
ArrayList<String>();//página sumario de cada magazine
public List<FullMagazine> downloadedMagazines = new
ArrayList<FullMagazine>();//todos los magazines bajados
public Magazines ms=null; //Esta clase contiene el array de previews de
revistas generado con el parser de XML
}
And i use these methods to store the class (SaveState object) in the sdcard
and to read the object from the file into an object again:
public static void saveData(){
ObjectOutput out;
try {
//primero comprobamos si existe el directorio, y si no, lo creamos.
File folder = new File(Environment.getExternalStorageDirectory() +
"/C/");
if(!folder.exists())
folder.mkdirs();
File outFile = new File(Environment.getExternalStorageDirectory(),
"/C/appSaveState.data");
out = new ObjectOutputStream(new FileOutputStream(outFile));
out.writeObject(saveState);
out.close();
} catch (Exception e) {e.printStackTrace();}
}
public static void loadData(){
ObjectInput in;
try {
File inFile = new File(Environment.getExternalStorageDirectory(),
"/C/appSaveState.data");
in = new ObjectInputStream(new FileInputStream(inFile));
saveState=(SaveState) in.readObject();
in.close();
} catch (Exception e) {e.printStackTrace();}
}
I store the object and each time my app is closed and i read the object
from the sdcard each time my app is opened and it works fine. The problem
comes when i created a newer version of my app (1.01). When i start the app
and i try to read the file from the sdcard the file is readed but all the
variables of the object class are empty..... and they are really not empty.
What is happening? how can i avoid that?
Thanks.
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en