Skip to main content

Maximum Size of SharedPreferences class


I want to save a lot of strings with SharedPreferences class . These strings are quit long. I really want to know the maximum length of a string that can be save in shared preferences in android.And Also How much size of data i can store in This SharedPrefernces class.



Source: Tips4all
Source: Tips4allSource: CCNA FINAL EXAM

Comments

  1. As per android architecture there is no such limit to store data in SharedPreference. Better way is to database (SQLite) when you have to deal with huge amount of data

    ReplyDelete
  2. I read somewhere that there is no hard limit other than Integer.MAX_VALUE ( maximal string length). But it is not advisable to store that much on shared preferences, as this is XML file which must be parsed and you will have a problems while parsing it.

    I used to store about 50-100KBytes there. It worked.

    ReplyDelete
  3. As in other answers there is no hard limit. If it is possible you can split your data in multiple SharedPreferences files, also you can compress your data. Huge xml files might be slower to read and write

    ReplyDelete

Post a Comment

Popular posts from this blog

Slow Android emulator

I have a 2.67 GHz Celeron processor, 1.21 GB of RAM on a x86 Windows XP Professional machine. My understanding is that the Android emulator should start fairly quickly on such a machine, but for me it does not. I have followed all instructions in setting up the IDE, SDKs, JDKs and such and have had some success in staring the emulator quickly but is very particulary. How can I, if possible, fix this problem?