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
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
ReplyDeleteI 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.
ReplyDeleteI used to store about 50-100KBytes there. It worked.
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