开发者

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

开发者 https://www.devze.com 2023-01-03 03:48 出处:网络
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

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

精彩评论

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