Android how many sharedpreferences file(s)?

前端 未结 1 1098
灰色年华
灰色年华 2021-01-28 22:21

I notice that when I call sharedpreferences file, I have to supply the name of the string name of the file. Does that mean that I can have multiple shared preferences files?

相关标签:
1条回答
  • 2021-01-28 22:55

    Your shared preferences are stored inside

    /data/data/package.name/shared_prefs/prefsname.xml
    

    The SharedPreferences class is just an "xml" data parser/writer.

    I don't think there are any specific limit but consider using SQLlite which is much faster (even 1000x times more) and provides easier select/sort being transaction friendly at the same time, sharedpres are useful just for storing user options for everything else i would look elsewhere.

    BTW i don't know any limit with SQLITE, if you exceed maximum DB side you can always use "ATTACH" clause to use more DB at the same tame (and if you have so much data to reach SQLite limits than XML / SharedPreferences is not for you at all)

    0 讨论(0)
提交回复
热议问题