I've been trying to save and load an object, but it isn't working. When I tell it to save, I have this:
public void doSave(View v) {
ObjectOutputStream out;
try {
FileOutputStream outFile = new FileOutputStream("testThingy321.ser");
out = new ObjectOutputStream(outFile);
out.writeObject(hero);
out.close();
outFile.close();
} catch (Exception e) {e.printStackTrace();}
}
And when I tell it to load, I have this:
try {
FileInputStream fileIn = new FileInputStream("testThingy321.ser");
ObjectInput in = new ObjectInputStream(fileIn);
hero = (Protag) in.readObject();
in.close();
fileIn.close();
} catch (Exception e) {e.printStackTrace();}
I don't have a good enough understanding of how this works to tell why it isn't working, and it's pretty much what the samples I've found have told me to say. However, it never seems to even do anything. Can someone tell me what I would have to do to let it save or load?
Edit: I checked the logcat and I'm getting this:
05-17 22:25:46.098: W/System.err(24774): java.io.FileNotFoundException: testThingy321.ser: open failed: EROFS (Read-only file system)