I have an Android application that creates a SQLite DB and populates it with some data.
How do I save this database to a file so it can be shipped with another application?
I have an Android application that creates a SQLite DB and populates it with some data.
How do I save this database to a file so it can be shipped with another application?
sqlite saves its data directly to a file. It's already done. The filename is specified in your connection string.
Are you trying to export to a different file type for some other software to read in?
You can access the SQLite database file from the DDMS percpective of Eclipse when the device is connected, it is stored with your application's files in /data/data/package_name/databases.
There is a guide on how to find and replace a database by a preset file:
http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/
Or you can just create an SQL command dump, and make it execute on first launch is initialized - however it will be realy time consuming.
To export your SQLite data to a file, use the .dump
command. See Exporting from SQLite to SQL Server