rxh wrote:
> I am new to the world of Android, and I have quick question.  I have
> an app that uses an existing SQLite database (in a .db file), and how
> do I package the .db file along with my application? 

You can't, at least not directly, AFAIK.

The solution I have been using is to use the .dump command in sqlite3 to
convert the database into SQL statements (create the table, create the
indexes, insert the data). Then, I put that file in res/raw/ and have my
SQLiteOpenHelper subclass execute the statements in that file. I have
put this all into my build process, so all I need to do is increment the
version number of the database in my SQLiteOpenHelper, and everything
else is automatic.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com

Android Training on the Ranch! -- Mar 16-20, 2009
http://www.bignerdranch.com/schedule.shtml

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Android Discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/android-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to