0

I have a question concerning data storage in android and hope to get some help here. I've tried searching for it, but couldn't find anything specific to my question. Please feel free to point me in the right direction, if I missed something.

I'm very new to android programming, having mostly experience in C++ and C#.

For my first project I picked something small. I want to programm an app for my wife and me, which manages the contents of our freezers. ;) It's simple. You create a freezer, define a certain amount of compartments and then add content to those compartments, which contain certain attributes (food type, amount, weight, expiration date etc).

Now, obviously this "database" will not contain a hell of a lot of info. Maybe 50 items tops? So from what I gathered XML might be a good way to go.

However, this data will be modified quite often. Things will be added, removed, modified, moved from one compartment to another. Would sqlite be a better choice in that situation?

I would greatly appreciate any advice you guys and girls might have. Again, small database, lots of modifications along the way ... XML or sqlite?

Thanks a lot in advance. :)

Michael

1 Answer 1

2

Although XML will work, but in terms of modification (change the data) and persistence (write to disk), it is certainly not as easy as SQLite.

With XML, you are constantly dealing with the entire document, even when you just want to deal with a little piece of it.

I found the API dealing with XML are quite often not so intuitive.

To be honest, XML has already passed its most glorious time. At one point, people express virtually everything as Xml whenever they had a chance. But that time has passed, and that's clearly not the situation any more.

Growing is a major consideration here too. I understand that it is small, but the size is one side, and the structure is the other side, XML is less flexible in terms how much code change you need to make when the structure of data changes.

Sign up to request clarification or add additional context in comments.

2 Comments

Hey Peter, thanks a lot for your detailed reply! Unfortunately I can't upvote your comment yet. So this is my way of saying thank you. :) Looking forward to more replys in case people have different opinions or more comments.
XML makes sense as an interchange format, and when you have actual markup. The latter is commonly overlooked.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.