SQlite or Shared Preferences

≯℡__Kan透↙ 提交于 2019-12-24 14:53:02

问题


In my android app I receive data as json like this:

    "_playLists":[{"name":"Playlist 1",

    "items":[{"name":"Poza 1","target":"...","url":"...","url_thumb":"..."},

    {"name":"Poza 2","target":"http:\/\/audifrance.fr","url":"...","url_thumb":..."}]},


    {"name":"Playlist 2",
    "items":[{"name":"Poza 3","target":"...","url":null,"url_thumb":null}]}]}

My question is : which is the best way to save data from this response: using Shared Preferences or using a database SQlite? Is it possible using Shared Preferences to make connections between the saved data?


回答1:


If there is no security concern with data, data is complex type and data is in large amount I think SQLite is the best for it.

And if the data is small, data is premitive type and you don't want to share it with user then SharedPreference is good.

Choice is yours.. Thanks.




回答2:


both have different purposes .

for small sized primitive data's where you don't want to invoke any queries use shared preferences .

for large sized , complex type storage , use sqLite



来源:https://stackoverflow.com/questions/7966751/sqlite-or-shared-preferences

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!