开发者

Help me choose between XML or SQL Lite on android

I have an android app that periodically, say once a week downloads content from a server in XML. The content is used by the app, different Acitivities use different parts of the c开发者_运维百科ontent.

My question is a design one, should I save the data in SQlite or just keep it as an XML file, which one would be faster to read?

The app can only use one content piece at a time, which means subsequent XML content downloads replace the old one.


I'd go for SQLite if at all possible. As my experiences go XML file operations get quite slow on hand held devices (bare in mind I worked on Windows Mobile system, but I think the principle involved is the same) as the files get bigger.

Reads will be faster in a SQLite data source, however you have to decide how important that is. How frequently will this really affect the system? How much extra work will there be to get your XML files to SQLite file? Will the conversion have to take place once or every time?

I decided to go with XML for that project and I think that now, about 6 months after the project has shipped, I would have made a different choice. File operations take up to a few seconds every time and users report it as very annoying and work flow breaking. However on that project file operations occur every few minutes or so. If the interval is longer or runs in background (users don't notice it) then I don't think there are many significant advantages in using SQLite.

I suggest thinking a lot about your choices since once the project ships it is almost impossible to change your decision.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜