0
点赞
收藏
分享

微信扫一扫

android 删除文件错误:open failed: EBUSY (Device or resource busy)

_刘彦辉 2022-11-08 阅读 69


引用:

​​http://stackoverflow.com/questions/11539657/open-failed-ebusy-device-or-resource-busy​​







I have the big Answer!! The Problem comes from the Android System or / and the FAT32 system. I can not explain how the system get the error, it has something to do with deleting files and the FAT32 System.

But the solution is really easy: Before you delete a Directory or File: rename it!

Code to rename:

final File to = new File(file.getAbsolutePath() + System.currentTimeMillis());
file.renameTo(to);
to.delete();

Thats it, if you rename the folder or file before you delete it, there is no chance for the system to try to open an existing file again or an open file wich you want to save again (or something like this).



举报

相关推荐

0 条评论