我正在实现一个在外部存储中生成和创建文件的应用程序。我怎样才能删除它?
编辑
我添加了以下代码,但我仍然遇到同样的问题。请参阅下面的代码:
String fullPath = "/mnt/sdcard/";
System.out.println(fullPath);
try{
File file = new File(fullPath, "audio.mp3");
if(file.exists()){
boolean result = file.delete();
System.out.println("Application able to delete the file and result is: " + result);
// file.delete();
}else{
System.out.println("Application doesn't able to delete the file");
}
}catch (Exception e){
Log.e("App", "Exception while deleting file " + e.getMessage());
}
在 LogCat 中,我让Application 能够删除文件,结果是:false。执行此操作后,我附上了我的屏幕截图。