Raist
Raist

Reputation: 99

SQLite - Can I send a database file with application?

Pretty simple question, can I send a already created database (a file, for instance) with my application? Or do I have to create it inside my application?

Upvotes: 0

Views: 149

Answers (3)

Philip Sheard
Philip Sheard

Reputation: 5825

Some apps include an SQLite database in the assets folder, and copy it when the app is launched.

Upvotes: 0

lenik
lenik

Reputation: 23556

you may put it into the assets/ folder and copy into the SQLite on the first run.

Upvotes: 0

Marcin Orlowski
Marcin Orlowski

Reputation: 75645

Yes you can do both. Either create on 1st launch or copy preconfigured database from assets.

For the latter option (which is basically significantly faster if you need your database to be pre-populated) you can use Android SQLiteAssetHelper to do all the job.

Upvotes: 3

Related Questions