Someone in irc was trying to figure out a way to store a sqlite
database in their app as a raw, then install the db in the right
database location at install time, instead of having to execute a
bunch of time consuming (?) insert commands.  The referenced thread
(http://groups.google.com/group/android-beginners/browse_thread/thread/
21ac3596a14f4a87) seems to be closed, at least I can't reply on it, so
I thought I'd throw out the code here.   Apologies if this isn't an
answer to what was asked.

Basically, saving off a database from the emulator and blowing it up
as a raw at runtime seems to  work. Just create the database and store
it on the emulator. Then use "adb pull" to pull the database from the
emulator onto your desktop.  Drop this .db in your project resources/
raw directory.

>From code, do something like this: http://pastebin.com/m50747bc5

"prepopulated.db" is the destination database string
"tableInDB" is some table in the destination database, used as a test
R.raw.preopulateddb is the resource ID of the source database.  This
is is what you copied off the emulator and stuck in your resources/raw
directory

This is pretty rough and tumble code.  Works for me as a test; thanks
for posing the problem as I'd have to get to this sooner or later, and
this just pushed the issue to well before I wanted to get to it...

-Brian
[sorry if this is a repost, the first attempt error'd out]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Beginners" 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-beginners?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to