• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Apps Cannot delete a file in Android 11

Hello,
`
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(i) != null) {
for (int i = 0; i < list.length; i++) {
list(i).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
 
Back
Top Bottom