我正在实现一个在外部存储中生成和创建文件的应用程序。如何删除它?
编辑
我添加了以下代码,但仍然遇到同样的问题。请查看我的代码:
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中,我看到了应用程序能够删除文件但结果为false的信息。执行后,我附上了屏幕截图。