you can export it to file, then read that file in at run time. however, if you are going to package the data with the app, i recommend just putting the database in your assets, and copying it to the database directory when you start up. it won't take long (compared to downloading from the net), and it is easier. either way, you waste the space.
how big is your db? On Jun 21, 12:52 pm, Georgy <[email protected]> wrote: > How can I dump my database to make it build on the fly? > > BEGIN TRANSACTION; > CREATE TABLE android_metadata (locale TEXT); > INSERT INTO "android_metadata" VALUES('en_US'); > CREATE TABLE 'olddominionuniversity' (_id integer primary key > autoincrement, university text not null, building text not null, > locode text not null); > INSERT INTO "olddominionuniversity" VALUES(1,'Old Dominion > University','Kaufman Hall','IDEA-7TCL'); > INSERT INTO "olddominionuniversity" VALUES(2,'Old Dominion > University','Perry Library','RE3S-XR5T'); > DELETE FROM sqlite_sequence; > INSERT INTO "sqlite_sequence" VALUES('olddominionuniversity',2); > CREATE TABLE harvarduniversity ( > "_id" INTEGER, > "university" TEXT, > "building" TEXT, > "locode" TEXT > ); > INSERT INTO "harvarduniversity" VALUES('_id','Harvard','Building > 1','TBA'); > COMMIT; > > I tried to put it as a string and execute it but I get all sorts of > error. When I did line by line, it worked, but I am talking bout a > HUGE database > > On Jun 21, 1:47 pm, Georgy <[email protected]> wrote: > > > my only way to do it was to dump the database and get the code and > > insert it in the database to build it on the fly just like Burton > > Miller suggested. > > > I think this is not the best approach and could slow things down > > tremendously > > > On Jun 20, 4:51 pm, burton miller <[email protected]> wrote: > > > > this was not possible in previous versions of the os - maybe it is > > > now. > > > > up until now, you have three options: > > > 1) build db on the fly > > > 2) put db in assets, then copy it to db directory when you first run > > > (2x space). > > > 3) install db from internet as a secondary installation > > > > if things have changed - then i'll rewrite one of my apps! > > > > On Jun 19, 12:43 pm, Georgy <[email protected]> wrote: > > > > > Hello > > > > > I have an SQL lite database that I am trying to copy to the device. I > > > > was able to copy it to the emulator easily using DDMS however with the > > > > protection in the device, I cannot access the database files from the > > > > DDMS perspective. > > > > > I read many attempts here but couldn't find an easy solution. > > > > > Is there any way to attach the database (let's say named 'proj') and > > > > replace the currently created database proj in he device files? > > > > > thanks --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Developers" 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-developers?hl=en -~----------~----~----~----~------~----~------~--~---

