我想从手机中删除一些图片。我有图像路径,我只是这样做
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();
}
即使我在打开图库时仍然存在文件被删除!这是为什么?我缺少什么?