diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java index 494ac1ce7..6eb884e9b 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/PhotosActivity.java @@ -183,7 +183,8 @@ public class PhotosActivity extends AppCompatActivity file.delete(); } - MediaScannerConnection.scanFile(this, new String[]{path}, null, null); + final String[] deletedPaths = toBeDeleted.toArray(new String[toBeDeleted.size()]); + MediaScannerConnection.scanFile(this, deletedPaths, null, null); } private View.OnClickListener undoDeletion = new View.OnClickListener() { diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java index d5b596bb6..00f586c2e 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -102,8 +102,10 @@ public class ViewPagerActivity extends AppCompatActivity private void deleteImage() { Helpers.showToast(this, R.string.deleting); final File file = getCurrentFile(); - file.delete(); - MediaScannerConnection.scanFile(this, new String[]{path}, null, this); + if (file.delete()) { + final String[] deletedPath = new String[]{file.getAbsolutePath()}; + MediaScannerConnection.scanFile(this, deletedPath, null, this); + } } private boolean isDirEmpty() {