开发者

Holding Information in Android App

I've only just started to write in Java on Android, so please bear with me.

I have some settings I want to hold in my app, normally I would have used an xml file. Trouble is i'm not sure how to load it into the xml parser to read it.

I thought I might be able to drop it into /res/values/I开发者_开发知识库nfo.xml and open it from there but it does'nt find the file.

I have also read that people are starting to use a SQLite database to hold information in, is this more the standard way to go?

thanks a lot

Luke


It sounds like what you want are Shared Preferences. Its a simple way of storing key value pairs, along with a UI for letting the user change them.


You could try storing to External Files (that way they can save settings on an SD card if they have 2.2). You wouldn't be able to modify the files in the res folder like you tried because these files get compiled into the app package. You could also try Internal Files found on the same page. SQLite might be a bit much for config settings.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜