开发者

Offline database in Android

开发者 https://www.devze.com 2023-03-16 08:29 出处:网络
There must be a better way to manage string values than to have a bunch of strings in strings.xml file.

There must be a better way to manage string values than to have a bunch of strings in strings.xml file.

I am looking for database like solution, however I don`t want it to connect to a database on the internet. It is just that I need some advanced sorting and categorisi开发者_C百科ng to be done that is all.

I am not very experienced with JAVA so pardon me if I just lack the knowledge.

EDIT: It would be nice that I could synchronize both database on the internet and on user`s smartphone.

Maybe effect of synchronization can be achieved by adding additional databases and sending out already modified data.


You can use a SQLite database for your app. See http://developer.android.com/guide/topics/data/data-storage.html#db


If you don't need to save them you could just use an array of strings or an array list if you have the user entering a bunch of strings or need dynamic sizing


Well, there are simpler alternatives to SQLite - you should at least consider some kind of ORM for Android. It'll let you to persist Java objects in a few lines of code instead of using SELECT, UPDATE, and marshalling data.

Consider db4o or something like that - it's rather large (~1M), though.


Why would you want to use SQLite for this? Remember that using a database connection for this (and only this) takes up resources that could be used elsewhere. If its strings that are only used as text (which never changes) in your program you are better of using the strings.xml. Not only is it faster, but it is also a Android Standard. Besides, if you decide one day into the future to translate your application to a different language I would guess it is much easier using the strings.xml file.

0

精彩评论

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