I’ve read many topic on stackoverflow,and google, about this argument but i can’t orient myself with writing custom ArrayList into files !
I’ve an ArrayList of type “CustomType”. “CustomType” have two String variable : “name” and “description”.
I want to save this ArrayList for reading it after closing and reopening my app.
Does anyone help me doing this? and does anyone explain me what happen when i save/read?
you could write it simply as a csv file, like this,
or you could use
gsonlibrary – http://code.google.com/p/google-gson/, to convert it into ajsonstring and then write it to a file, that way when you read it you could directly get the object fromjson,i would personally use the second method,
Edit: for writing to csv
(assuming the object in side the ArrayList has methods
getName()andgetDesc())this might be helpful in reading it again,
Get and Parse CSV file in android