Hi Soylu,
First u check whether myContext.getAssets().open(ASSETS_DB_FOLDER+"/"+dbFiles[i]); files exists or not then then copy method do it in asyntask Moktarul On Tuesday, 13 March 2012 03:30:16 UTC+5:30, Halil Enver Soylu wrote: > > I have a 5MB database. I split it into <1MB chuck files. > application merges these files and creates its database. > > However it works in some Android phones, and does not works in others. I > tried almost dozen of code example in blogs. everytime I got same result. > App's platform vers. is 1.5 so it is not about platform vers. > > According to logs of phones that application crushs, app creates copies db > file from Assets to database. then when it attempts to get a query for the > first time, it crushs and gives that error: > > 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg = > database corruption at line 46886 of [42537b6056] > 03-11 01:11:34.111 I/Database( 4516): sqlite returned: error code = 11, msg = > database disk image is malformed > 03-11 01:11:34.111 D/AndroidRuntime( 4516): Shutting down VM > 03-11 01:11:34.111 W/dalvikvm( 4516): threadid=1: thread exiting with > uncaught exception (group=0x40018560) > 03-11 01:11:34.111 E/AndroidRuntime( 4516): FATAL EXCEPTION: main > 03-11 01:11:34.111 E/AndroidRuntime( 4516): > android.database.sqlite.SQLiteDatabaseCorruptException: database disk image > is malformed: , while compiling: SELECT Names FROM MYTABLE WHERE SayfaNo = 1 > > > and here is my codes that copies asset files into database > > > String[] dbFiles = myContext.getAssets().list(ASSETS_DB_FOLDER); > OutputStream myOutput = new FileOutputStream(DB_PATH+DB_NAME); > for(int i =0; i < dbFiles.length; i++) > { > Log.i("FFLOG","COPYDB:"+dbFiles[i]); > InputStream myInput = > myContext.getAssets().open(ASSETS_DB_FOLDER+"/"+dbFiles[i]); > byte[] buffer = new byte[1024]; > int length; > while ((length = myInput.read(buffer)) > 0) { > myOutput.write(buffer, 0, length); > } > myInput.close(); > } > myOutput.flush(); > myOutput.close(); > > please help me!!!! > if there were a problem about database file or query SQL code, it would > not work in some phones. So, it is not about db file or query. I am looking > for a solution for 2 weeks please help me > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to android-developers@googlegroups.com To unsubscribe from this group, send email to android-developers+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/android-developers?hl=en