Problem with file.delete() in Android 11

robertanisoiu

New member
Aug 2, 2021
1
0
0
I have an application that make photos into a subdirectory called "DesPictures" in Environment.DIRECTORY_DCIM public directory

Another application scan the "DesPictures" directory and delete the photos one by one.

In Android 10 the code is:
dir = new File (Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM) + "/DesPictures");
File list[] = dir.listFiles();
if (list != null) {
for (int i = 0; i < list.length; i++) {
list.delete(); //WORKS IN Android 10 but DOES NOT WORK IN Android 11
}
}

Can anybody help me, please, in order to delete each list in Android 11? Thank you
 

Trending Posts

Members online

Forum statistics

Threads
957,560
Messages
6,973,585
Members
3,163,856
Latest member
vicinity