Is using Android shared preferences for storing large amounts of data a good idea?

后端 未结 2 1817
孤街浪徒
孤街浪徒 2021-02-07 22:31

So I inherited this Android project from someone else. The code currently seems to be storing huge amounts of data (that should really belong to an SQLite database) into the sha

2条回答
  •  心在旅途
    2021-02-07 22:54

    If it works now then you can definitely leave it. You are correct that the large amounts of data should go into the database. If nothing else, you'll have an easier time of querying for data.

    Further research has found this post suggesting that you won't have any major problems with a large amount of data in your Shared Prefs. You could, however, have performance issues since the single Shared Pref XML file will have to be read to get any pref while with a database you only have to grab what you need as you need it.

提交回复
热议问题