You must have seen all the Storage Options that android provides. If you read the SharedPreference
part, it provides a general framework that allows you to save and retrieve persistent key-value pairs of primitive data types
. It also supports saving sets
and ArrayList
. See Save ArrayList to SharedPreferences questions. If you just want to store the last played song ID's, then using SharedPreference
might be preferable. It is also faster than using database.
However, if you have more structured data, then using database might be better to manage. To know more about when SharedPreference
would be good to use and when SQL Lite
database, read Pros and Cons of SQLite and Shared Preferences .