Answer the question
In order to leave comments, you need to log in
Where is the file where ArrayList is written?
I found on one site such an option for serializing an object in android:
public static void readFromFile(String filename) {
try {
FileInputStream fis = sContext.openFileInput(filename + ".dat");
ObjectInputStream is = new ObjectInputStream(fis);
content = (ArrayList<Integer>) is.readObject();
is.close();
} catch (IOException w) {
w.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
public static void writeToFile(String filename) {
try {
FileOutputStream fos = sContext.openFileOutput(filename + ".dat",
Context.MODE_PRIVATE);
ObjectOutputStream os = new ObjectOutputStream(fos);
os.writeObject(content);
os.close();
} catch (IOException w) {
w.printStackTrace();
}
}
Answer the question
In order to leave comments, you need to log in
The documentation says
https://developer.android.com/reference/android/co...
Open a private file associated with this Context's application package for reading.
I guess /data/data/yourpackage/files
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question