0

My application collects data about the battery. I need to be able to edit this data with add/remove options.

What is the most suitable way to store this data? I though about two ways: XML file or data-base using SQL.

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Alex K
  • 5,092
  • 15
  • 50
  • 77
  • Is the amount of data fixed in size? – Che Jami Jul 14 '11 at 14:50
  • 1
    Highly depends on what you want to do with that data. – mibollma Jul 14 '11 at 14:50
  • 1
    I agree, the amount of data and what you want to do with it. A lot of growing complex data = database. Simple fixed data that you may want to transfer around in a readable format = xml. Another alternative (quickest) is to serialise the data to file but you need a memory permitting size cap. – Che Jami Jul 14 '11 at 15:02
  • The amount of data is 100 rows at max. I need it for backup in case the app crashes or the device will be rebooted. – Alex K Jul 14 '11 at 15:08

1 Answers1

2

You should use SQLite Database for this. I assume battery data is a lot of entries of well defined format (i.e. charge level, current temp, timestamp and so on). And this is a classic example when databases should be used.

XML is too resource heavy for potentially large amount of data, that should be editable. Also XML will not provide you with relatively easy to use select statement for data analysis. You'll need to load all data into memory and select data manually.

inazaruk
  • 74,247
  • 24
  • 188
  • 156