I am programming a simple I/O system to store data needed by my Android application. I use an ObjectInputStream
with the following initialization ("context" is the object obtained with getApplicationContext()
:
ObjectInputStream ois = new ObjectInputStream(
new BufferedInputStream(context.openFileInput("data.bin")));
Then I use ois.readObject()
to fill an ArrayList
.
My application works perfectly on the emulator, but crashes when calling the oos.close()
method on a real device (Samsung Galaxy SII).
I cannot find where the problem is. Do I have to add some permissions or something like that to use internal storage? Have I forgotten something?
Thank you for your answers.