I have an arraylist. I need to store them as persistent data. How can I achieve this in android? Can shared preferences help?
Asked
Active
Viewed 3,131 times
1
-
1You can use SharedPreferences but there you'll have to convert your data in some manner, since there is no `putArrayList()` method. – Sam Jan 25 '13 at 20:59
-
1Put into shared preferences as already explained and discussed in [this question](http://stackoverflow.com/questions/7057845/save-arraylist-to-sharedpreferences) – Audrius Meškauskas Jan 25 '13 at 21:01
2 Answers
0
There are several ways depending on what the data is and what you plan to do with it. SharedPrefs, SQLite DB, and internal storage are all options. But like I said, it depends on what you are going to do. The Docs explain all of these and you will need to decide what fits you best.

codeMagic
- 44,549
- 13
- 77
- 93
0
I don't think you will be able to use SharedPreferences for an ArrayList in a simple way (even in anyway) as there is not some putObject()
or putSerializable()
method in the SharedPreference.Editor class.
But there are several others storage options.

Mickäel A.
- 9,012
- 5
- 54
- 71