Search code examples
javaandroiddatabasesavesd-card

Is it possible to copy database file to SD card?


I have a database on my Android phone, and I need to get the information onto an SD card.

Is it possible to save the database file onto the SD card in a readable state? I haven't been able to find any information on how to do this.

Some source code that copies the database file to an SD card would be ideal.


Solution

  • The database file is just like any other file, if you make a binary file copy it will work.

    Java has no built in file copy method, so you can use this:

    Standard concise way to copy a file in Java?

    Just don't forget to add your manifest permission to write to the SD card:
    Permission to write to the SD card