I want to delete some images from my phone. I have image path and I simply do this
try {
File file = new File(content);
if (file.canRead()) {
boolean mDeleleFile = file.delete();
sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(new File(content))));
if (mDeleleFile) {
Toast.makeText(getApplicationContext(), "File deleted", Toast.LENGTH_LONG).show();
}
}
} catch (Exception e) {
e.printStackTrace();
}
Even if I get File deleted when I open gallery image still exist! Why is that? What I'm missing?