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 卡?


基础教程推荐
- 如何在 Spring @Value 注解中正确指定默认值? 2022-01-01
- Java 实例变量在两个语句中声明和初始化 2022-01-01
- 在 Java 中创建日期的正确方法是什么? 2022-01-01
- 验证是否调用了所有 getter 方法 2022-01-01
- 大摇大摆的枚举 2022-01-01
- 如何在 JFrame 中覆盖 windowsClosing 事件 2022-01-01
- Java Swing计时器未清除 2022-01-01
- 不推荐使用 Api 注释的描述 2022-01-01
- 从 python 访问 JVM 2022-01-01
- 多个组件的复杂布局 2022-01-01