- public void deleteFileInMediaScan(String path) {
- getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
- MediaStore.Images.Media.DATA + "=?", new String[]{path});
+ public void deleteFileInMediaScan(OCFile file) {
+
+ String path = file.getStoragePath();
+ if (file.isImage()) {
+ // Images
+ getContentResolver().delete(MediaStore.Images.Media.EXTERNAL_CONTENT_URI,
+ MediaStore.Images.Media.DATA + "=?", new String[]{path});
+ } else if (file.isAudio()) {
+ // Audio
+ getContentResolver().delete(MediaStore.Audio.Media.EXTERNAL_CONTENT_URI,
+ MediaStore.Audio.Media.DATA + "=?", new String[]{path});
+ } else if (file.isVideo()) {
+ // Video
+ getContentResolver().delete(MediaStore.Video.Media.EXTERNAL_CONTENT_URI,
+ MediaStore.Video.Media.DATA + "=?", new String[]{path});
+ }