so how i can do it? i remember in one of examples i saw file with line structure: data 1 | data2 | data 3 and application was created db from this file on phone so you suggest i should convert my db into text file, and try open text file im my app to placed content of this file into db created by phone
but i cant create regular sql db and try to add it into project? bugger On 29 Oct, 13:35, DanH <[email protected]> wrote: > Oddly, you can't "pre-load" a database. You have to create it on the > phone and load it up from a flat file or some other source. > > On Oct 29, 6:13 am, Mad Troll <[email protected]> > wrote: > > > I created database in sql lite with commands: > > sqlite.exe > > CREATE TABLE "android_metadata" ("locale" TEXT DEFAULT 'en_US'); > > INSERT INTO "android_metadata" VALUES ('en_US'); > > CREATE TABLE "myTable" ("ID" int); > > INSERT INTO "myTable" VALUES ('1'); > > ..................... > > etc. > > i saved to file myDatabase.db > > and i'm trying open it through android. > > I open new project in eclipse > > i put my database in assets folder > > and i tried open my db using code: > > > SQLiteDatabase checkDB = null; > > String DB_PATH = "/data/data/my.andoid.app/databases/"; > > String DB_PATH = "myDatabase.db"; > > > try{ > > String myPath =DB_PATH + DB_NAME; > > checkDB = SQLiteDatabase.openDatabase(myPath, null, > > SQLiteDatabase.OPEN_READONLY); > > > }catch(SQLiteException e){ > > return e.getMessage(); > > } > > > And i can't open my database. > > Could anyone help me and point me what i'm doing wrong? > > regards -- 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

