开发者

How do I put static data into an SQLite database in Android?

If I have a bunch of data that is never going to change (eg. an E开发者_开发百科nglish language dictionary or the rgb values of a couple hundred color names), how do I use an SQLite database to store it? I know a database is faster than loading everything into memory when the app starts, but how do I make the database either the first time the app runs or "before" the apps ever runs?


Why not just put it in SharedPreferences files? (Check here) No need to have all the power (overhead) of a SQLite database if all you'll be doing with this data is loading once and simple look ups (no updates, inserts, queries, etc)


Feed it a SQL file of CREATE and INSERTs during installation time and discard the initialization file.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜