public static void save() {
String dbpath = "/data/data/tl.cac.view/databases/"
+"afinal.db";
boolean success=copyFile(dbpath, Environment.getExternalStorageDirectory() + "/"
+ "afinal.db");
}
public static boolean copyFile(String source, String dest) {
try {
File f1 = new File(source);
File f2 = new File(dest);
InputStream in = new FileInputStream(f1);
OutputStream out = new FileOutputStream(f2);
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0)
out.write(buf, 0, len);
in.close();
out.close();
} catch (FileNotFoundException ex) {
return false;
} catch (IOException e) {
return false;
}
return true;
}
android 代码将数据库文件导出到sd卡
最新推荐文章于 2023-01-03 00:07:43 发布