开发者

Simple Access w\Read&Write to XML file using Android

I'm new to android development, and I'm trying to work a very simple database solution. I have a max of five variables I开发者_如何学C want to store when the app is installed, and I want the user to be able to change these variables and their changes be remembered after they've closed the app. While I could use the built in SQLite feature, that's way more complex than I need.

Normally in other languages, like VB, C#, and Javascript, I just load the XML into an XML object and then navigate the nodes. Is there any way to do that in android? This solution should only be a dozen or so lines of code within a single class.

If this isn't possible, what is the simplest way to store and retrieve simple data?


This is a common question and of course there is a way. Use Simple XML. I wrote a blog post on how to make that happen.

Essentially the Simple XML library lets you marshal and un-marshal XML to and from Java Classes by correctly annotating them with Simple XML Annotations. Just read the simple tutorial and my blog post to understand what I mean.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜