如何备份我的数据库到我的应用程序自动SD卡? 而后来,我怎么恢复呢?
How can I backup my database to the sdcard automatically in my app? And afterward, how do I restore it?
下面是我的code:
// Local database
InputStream input = new FileInputStream(from);
// create directory for backup
File dir = new File(DB_BACKUP_PATH);
dir.mkdir();
// Path to the external backup
OutputStream output = new FileOutputStream(to);
// transfer bytes from the Input File to the Output File
byte[] buffer = new byte[1024];
int length;
while ((length = input.read(buffer))>0) {
output.write(buffer, 0, length);
}
output.flush();
output.close();
input.close();
上一篇:机器人:确定范围内的WiFi网络的安全型(无连接到它们)范围内、连接到、机器人、安全
下一篇:安卓的Microsoft Office库(doc和的.docx,.xls的,.PPT等)doc、Office、Microsoft、PPT