Reputation: 1634
Hello I'm working on an android program that uses a database. My database is going include about 300 to 400 records.
My question is what is be best way to work with the database. Should I create the database at run time via code and insert the records "manually" every time the program starts, or should I use an external database, that's located in the /assetes folder of the program?
If the second option is the way to go, could someone please give me an advice on how to do that, because I can't find any toturial that covers this subject.
Thank you!
Upvotes: 1
Views: 788
Reputation: 14025
Here is a tutorial for the 2nd option you mentioned.
Put your db in the asset folder and if DB does not exist in /data/data/YOUR_PACKAGE/databases/
, it will copy the database over.
Upvotes: 0
Reputation: 11522
There's another option, which is to initialize the database the first time the program is launched. See the SQLiteOpenHelper class, and especially the onCreate method in that class.
Upvotes: 2