是采用Android共享preferences用于存储大量数据的好主意吗? [英] Is using Android shared preferences for storing large amounts of data a good idea?

查看:147
本文介绍了是采用Android共享preferences用于存储大量数据的好主意吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我继承了这个Android项目从别人。在code目前看来是存储大量的数据(实际上应当属于一个SQLite数据库)复制到共享preferences。我非常不舒服的code的一部分,并希望开始使用SQLite数据库。但我仍然无法证明我自己的时间,将采取特别是如果它没有直接的好处。

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 shared preferences. I'm very uncomfortable with that part of the code and want to start using the sqlite database. But I am still unable to justify to myself the time it would take especially if it comes with no immediate benefits.

当然,我最终将其移动到SQLite的,但因为我有点在紧张的最后期限,我想如果这是值得现在或以后的东西做的。

Of course I'm eventually going to move it to sqlite but since I'm kinda on a tight deadline I was wondering if this is worth something doing now or later.

上存储大量的共享preferences数据的任何想法和意见将非常AP preciated。

Any thoughts and comments on storing large amounts of data in shared preferences would be very much appreciated.

感谢

推荐答案

如果它现在的工作,那么你绝对可以离开它。你是正确的,因为大量的数据应该进入数据库。如果不出意外,你必须在查询数据的时候更容易。

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.

进一步的研究发现,这个帖子暗示,你不会有什么大问题与大量在共用preFS数据。你可以,不过,有性能问题,因为单一的共享preF XML文件必须被理解为得到任何$ P $粉煤,同时与数据库你只需要抓住你需要什么,你需要它。

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.

这篇关于是采用Android共享preferences用于存储大量数据的好主意吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆