I have an application using an internal SQLite database.
Now I want to replace it with a database file stored on the SDCard.
After copying the file using standard input/output methods I tried to open a connection, but got an exception that table xyz already exists, so it looks like my SQLiteOpenHelper rerun OnCreate even though the database was already present.
The database was an exact copy of a database created by the helper, I just pulled it down, added a few dummy entries and pushed it back to the SDCard where I used my import method to copy it to my package/database directory.
What am I missing? How do I correctly overwrite an existing database with an external one without selecting and inserting row by row?
Also, how do I export an internal database to the SDCard? I tried the normal IO methods, but it looks like I don't have write access to /sdcard/.
I used
Using java Syntax Highlighting
- File ofd = Environment.getExternalStorageDirectory();
- ofd.canWrite();
Parsed in 0.030 seconds, using GeSHi 1.0.8.4
but it always returns false.
Is there any way to get write permission for the SDCard?
The SDCard is present and mounted, I can read files just fine.
Thank you.



