I have a peice of code that scans for all files in a directory and it should delete those files. But for some reason it's not deleting them.
What I have is this:
String path = Environment.getExternalStorageDirectory().getAbsolutePath()+"/Images/";
File f = new File(path);
File file[] = f.listFiles();
for (File aFile : file) {
boolean isDeleted = aFile.delete();
if(isDeleted) {
log.d("file", "is deleted");
}
}
When I debug this code then it says for every file that isDeleted
is true
. But when I check the "Gallery/Images" folder on my phone I see that all images are still there...
I also have the following two permission in my manifest:
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
Anyone any idea why the files aren't deleted, eventhough it says isDeleted
is true
?