diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java index 7183ffb11..0c7a8e634 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MainActivity.java @@ -356,7 +356,7 @@ public class MainActivity extends SimpleActivity } final String[] deletedPaths = updatedFiles.toArray(new String[updatedFiles.size()]); - MediaScannerConnection.scanFile(this, deletedPaths, null, null); + MediaScannerConnection.scanFile(getApplicationContext(), deletedPaths, null, null); mToBeDeleted.clear(); } diff --git a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java index 38fa0bb6c..1e44f19af 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/MediaActivity.java @@ -339,7 +339,7 @@ public class MediaActivity extends SimpleActivity } final String[] deletedPaths = mToBeDeleted.toArray(new String[mToBeDeleted.size()]); - MediaScannerConnection.scanFile(this, deletedPaths, null, new MediaScannerConnection.OnScanCompletedListener() { + MediaScannerConnection.scanFile(getApplicationContext(), deletedPaths, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { if (mMedia != null && mMedia.isEmpty()) { 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 01571c709..80e5ae5b8 100644 --- a/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java +++ b/app/src/main/java/com/simplemobiletools/gallery/activities/ViewPagerActivity.java @@ -100,7 +100,7 @@ public class ViewPagerActivity extends SimpleActivity mBeingDeleted = ""; hideSystemUI(); - MediaScannerConnection.scanFile(this, new String[]{mPath}, null, null); + MediaScannerConnection.scanFile(getApplicationContext(), new String[]{mPath}, null, null); addUndoMargin(); mDirectory = new File(mPath).getParent(); mMedia = getMedia(); @@ -256,7 +256,7 @@ public class ViewPagerActivity extends SimpleActivity if (file.delete()) { mBeingDeleted = mToBeDeleted; final String[] deletedPath = new String[]{mToBeDeleted}; - MediaScannerConnection.scanFile(this, deletedPath, null, new MediaScannerConnection.OnScanCompletedListener() { + MediaScannerConnection.scanFile(getApplicationContext(), deletedPath, null, new MediaScannerConnection.OnScanCompletedListener() { @Override public void onScanCompleted(String path, Uri uri) { scanCompleted();