I want user click action delete image and image will be deleted in gallery. How to delete image in gallery from my phone. I have tried all code in this link stackoverflow but still can't delete image in gallery from my device phone android: deleting an image How to delete a file from Gallery in Android? How to delete an image from device in Android programmatically?
Try this:
File fdelete = new File(uri.getPath());
if (fdelete.exists()) {
if (fdelete.delete()) {
System.out.println("file Deleted :" + uri.getPath());
} else {
System.out.println("file not Deleted :" + uri.getPath());
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.