Is it possible to copy database file to SD card?(是否可以将数据库文件复制到 SD 卡?)
问题描述
我的 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
这篇关于是否可以将数据库文件复制到 SD 卡?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:是否可以将数据库文件复制到 SD 卡?


- 未找到/usr/local/lib 中的库 2022-01-01
- 如何使 JFrame 背景和 JPanel 透明且仅显示图像 2022-01-01
- 转换 ldap 日期 2022-01-01
- Eclipse 的最佳 XML 编辑器 2022-01-01
- 获取数字的最后一位 2022-01-01
- 在 Java 中,如何将 String 转换为 char 或将 char 转换 2022-01-01
- 将 Java Swing 桌面应用程序国际化的最佳实践是什么? 2022-01-01
- GC_FOR_ALLOC 是否更“严重"?在调查内存使用情况时? 2022-01-01
- java.lang.IllegalStateException:Bean 名称“类别"的 BindingResult 和普通目标对象都不能用作请求属性 2022-01-01
- 如何指定 CORS 的响应标头? 2022-01-01