简体   繁体   English

Android - Sqlite还是Xml?

[英]Android - Sqlite or Xml?

I am working on an android app that takes measures from an activity like 我正在开发一个Android应用程序,它采取类似的活动的措施

date + time + int1 + int2 + int3 + string . date + time + int1 + int2 + int3 + string

I want to save those measures and then : 我想保存这些措施然后:

1) activity to show them in a list sorted by date + time and show only 1)活动将它们显示在按日期+时间排序的列表中并仅显示

 date + time + int1 + int 2

and when i click on to show all the fields in a new activity or a toast or a dialog 当我点击显示新活动或吐司或对话框中的所有字段时

2) activity to be able to send the last day/ last 7 days / last 30 days records attached to an email 2)能够发送附加到电子邮件的最后一天/最近7天/最近30天记录的活动

3) activity to draw 2-3 charts like pie chart/other using the records 3)使用记录绘制饼图/其他图表等2-3个图表的活动

4) i want to be able to send these records to Microsoft Healthsvault(it needs them at specific xml pattern) 4)我希望能够将这些记录发送到Microsoft Healthsvault(它需要特定的xml模式)

Now i don't know how to go on.Should i use xml to save these records or sqlite.Which is better with what i want to do like charts etc If i save them in a sqlite db can i easily export data to an xml file?or should i use only xml.It is convenient xml for the things i want to make? 现在我不知道如何继续。我应该使用xml保存这些记录或sqlite.Which更好的我想做的图表等如果我将它们保存在sqlite数据库中我可以轻松地将数据导出到xml文件?或者我应该只使用xml。对于我想要制作的东西,这是方便的xml吗?

I've been looking into this myself a lot lately for my app and I think I've finally decided that SQLite is the way to go. 我最近一直在为自己的应用程序调查这个问题,我想我终于决定使用SQLite了。 It looks like xml is initially more straightforward but SQLite might be best for performance reasons. 看起来xml最初更直接,但SQLite可能是出于性能原因的最佳选择。 Or so I think. 或者我认为。

There is a thread about the choice between SQLite and XML : 有一个关于SQLite和XML之间选择的线程:

Xml or Sqlite, When to drop Xml for a Database? Xml或Sqlite,何时删除数据库的Xml?

For your case, you want to store data, then extract them in a particular order : SQLite provides this functionnality natively... 对于您的情况,您希望存储数据,然后按特定顺序提取它们:SQLite本身提供此功能...

Moreover, I think you can build an XML instance from a ResultSet easily (I don't know how to do it precisely, but I think it's not so hard). 而且,我认为你可以轻松地从ResultSet构建一个XML实例(我不知道如何准确地完成它,但我认为这并不是那么难)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM