[英]Android, Best way to store lists of data
I'm stuck on how I should go about storing some user data in my application I'm building. 我被困在如何将一些用户数据存储在正在构建的应用程序中的问题上。
The data being stored is effectively a list of items, like a list of car objects. 实际上,存储的数据是项目列表,例如汽车对象列表。 The application must be able to store multiple lists. 该应用程序必须能够存储多个列表。
Now i know there's several ways to store data, but I'm unsure what would be the best approach to storing these multiple lists. 现在我知道有几种存储数据的方法,但是我不确定什么是存储这些多个列表的最佳方法。
so far i can only think of: 到目前为止,我只能想到:
1) create table(s) for the lists. 1)为列表创建表。
2) storing each list as either a text file or xml file. 2)将每个列表存储为文本文件或xml文件。
if anyone can explain what would be the best approach and if there are better alternatives what they would be. 如果有人可以解释什么是最好的方法,以及是否有更好的选择,他们会是什么。
There are basically a few options: 基本上有几种选择:
Pros/Cons: 优点缺点:
So in the end, it depends on your use case. 因此,最后取决于您的用例。
Further readings: https://developer.android.com/guide/topics/data/data-storage.html 进一步阅读: https : //developer.android.com/guide/topics/data/data-storage.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.