Save an ArrayList to File on android

Viewed 25473

I have an ArrayList full of strings that the user populated it with to use in a different activity in a ListView to view the strings they have saved. I want the ArrayList they populated to be saved but I am so lost on how to get it to work. I've tried FileOutputStream, SharedPreferences. I looked at many examples.

for example i have

ArrayList<String> give = new ArrayList<String>();

and to save the arraylist ive tried stuff like

FileOutputStream fos = openFileOutput(MYFILENAME, Context.MODE_PRIVATE);
fos.write(give.getBytes());
fos.close();

but this does not work at all

2 Answers
Related