Backup and restore SQLite database to sdcard

How can i backup my database to the
sdcard automatically in my app?

Copy it using standard Java I/O. Make sure you don’t have any open SQLiteDatabase objects, though.

And afterwards how do i restore it?

Copy it using standard Java I/O. Make sure you don’t have any open SQLiteDatabase objects to the old database, though.

You can use getPath() on a SQLiteDatabase object to find out where it resides, AFAIK (haven’t tried this).

Leave a Comment