Reputation: 2773
I have a question. In my project I have some user preferences which are stored in the SQL database. There are about 200 records and the table has 3 columns. This records do not change, only if the user is changed and the data is downloaded again. I want to put them in SharedPreferences because it would be easier to manipulate the code. The way it is now, it's a bit difficult as I make the queries asynchronous. Now, my question is: Is the number of records to large for SharedPrefrences? Or it should be no problem to store them there?
Upvotes: 2
Views: 4604
Reputation: 5979
Shared Preferences:
All shared prefs are stored in /data/data/[package name]/shared_prefs/[app name].xml, so i think there's no limit based on aechitecture.
Shared Preferences is nothing but a simple table which has two columns. (key, value).
Shared Preference size 8192 characters according to this documentation: http://developer.android.com/reference/java/util/prefs/Preferences.html#MAX_VALUE_LENGTH
advantages:
disadvantages
Database:
When we have a lot of values to store with complex structure, we are left with only one great solution, ie. DB.
advantages
disadvantages
Operation is little bit slow comparing to shared preferences. user can clear this at any time.
Upvotes: 5