title: How to refresh gallery after deleting list of images in android?
body: <p>I want to know how to refresh the gallery after deleting list of images.I am using the following method for deleting and refreshing.</p>
  
  <pre><code>    public static void deleteFile(Context context,String path) {
  
          File file = new File(path);
          String abspath = file.getAbsolutePath();
          File f = new File(abspath);
          if (f.exists()) {
              if (f.delete()) {
  
                  deleteFileFromMediaStore(context.getContentResolver(),f);
  
              } else {
                  CommonlyUsed.logmsg(" file not deleted " + (cnt++));
              }
          }
  
  public static void deleteFileFromMediaStore(final ContentResolver contentResolver, final File file) {
      String canonicalPath;
      try {
          canonicalPath = file.getCanonicalPath();
      } catch (IOException e) {
          canonicalPath = file.getAbsolutePath();
      }
      final Uri uri = MediaStore.Files.getContentUri("external");
      final int result = contentResolver.delete(uri,MediaStore.Files.FileColumns.DATA + "=?", new String[] {canonicalPath});
      if (result == 0) {
          final String absolutePath = file.getAbsolutePath();
          if (!absolutePath.equals(canonicalPath)) {
              contentResolver.delete(uri,MediaStore.Files.FileColumns.DATA + "=?", new String[]{absolutePath});
          }
      }
  }
  </code></pre>
  
  <p>but it take more time for deleting and refreshing around 8000 images. which is the better way to delete and refresh.</p>