Android SQLite database being deleted on "SQLiteDatabase.openDatabase"
I copy over a valid Android SQLite database from the apk to the databases folder on my AVD. I verify with the DDMS FileExplorer that it is there and the size is correct. When I call the following function to open it,
mDb = SQLiteDatabase.openDatabase(mDatabase_path, null,
SQLiteDatabase.OPEN_READONLY);
The SQLite DB file is deleted and a SQLiteException, "Unable to open database" is thrown.
What could be deleting it if it exists before the line, then i开发者_如何学Gos gone after?
Ian
My copy function was missing the first byte so corrupting the DB. Android will in that case delete the DB and try to recreate it.
精彩评论