【发布时间】:2015-04-22 07:26:29
【问题描述】:
我正在尝试将文件从内部存储卡复制到外部存储卡 通过谷歌搜索,我找到了这个答案
try {
InputStream in = new FileInputStream("/storage/sdcard1/bluetooth/file7.zip"); // Memory card path
File myFile = new File("/storage/sdcard/"); //
OutputStream out = new FileOutputStream(myFile);
// Copy the bits from instream to outstream
byte[] buf = new byte[1024];
int len;
while ((len = in.read(buf)) > 0) {
out.write(buf, 0, len);
}
in.close();
out.close();
session.showToast("file copied sucessfully");
} catch (FileNotFoundException e) {
showToast(e.getMessage());
e.printStackTrace();
} catch (IOException e) {
showToast(e.getMessage());
e.printStackTrace();
}
它的工作是内部移动到内部或外部存储到外部 但是交叉传输不起作用,它会引发错误 Erofs 只读文件系统
【问题讨论】:
-
发布 logcat 输出以获得更好的想法!
-
@PareshMayani /storage/sdcard:open 失败:EROFS(只读文件系统)
-
在您的问题中包含完整的 logcat 输出!
-
您正在将此位置用于内部存储器:“/storage/sdcard/”。您确定这是用于内部存储吗?
-
@RahulSharma 是的,内部副本效果很好