是否可以将数据库文件复制到 SD 卡?

2022-01-24 00:00:00 database save android java sd-card

我的 Android 手机上有一个数据库,我需要将信息存入 SD 卡.

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

是否可以将数据库文件以可读状态保存到 SD 卡上?我无法找到有关如何执行此操作的任何信息.

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.

一些将数据库文件复制到 SD 卡的源代码是理想的选择.

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

推荐答案

数据库文件和其他文件一样,如果你复制一个二进制文件就可以了.

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

Java 没有内置的文件复制方法,所以你可以使用这个:

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

复制文件的标准简洁方式在 Java 中?

请不要忘记添加您的清单权限以写入 SD 卡:
写入 SD 卡的权限

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

相关文章