title: Gallery Refreshing in android
body: <p>I am deleting the file from  Gallery in  my application .The file is deleted successfully but  after deletion the file  still showing in the Gallery  until i restart my device. 
  I have tried different Solution like </p>
  
  <blockquote>
  <pre><code>       Intent intent = new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE,
                 Uri.fromFile(from.getParentFile()));
            sendBroadcast(intent);
  </code></pre>
  </blockquote>
  
  <p>and  media Scanner </p>
  
  <pre><code>public class SingalmediaScaner implements MediaScannerConnectionClient {
  
  private MediaScannerConnection mMs;
  private File mFile;
  
  public SingalmediaScaner(Context context, File f) {
      mFile = f;
      mMs = new MediaScannerConnection(context, this);
      mMs.connect();
  }
  
  @Override
  public void onMediaScannerConnected() {
      mMs.scanFile(mFile.toString(), null);
  }
  
  @Override
  public void onScanCompleted(String path, Uri uri) {
      mMs.disconnect();
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>private static void removeThumbnails(ContentResolver contentResolver,
          long photoId) {
      Cursor thumbnails = contentResolver.query(
              Thumbnails.EXTERNAL_CONTENT_URI, null, Thumbnails.IMAGE_ID
                      + "=?", new String[] { String.valueOf(photoId) }, null);
      for (thumbnails.moveToFirst(); !thumbnails.isAfterLast(); thumbnails
              .moveToNext()) {
  
          long thumbnailId = thumbnails.getLong(thumbnails
              .getColumnIndex(Thumbnails._ID));
      String path = thumbnails.getString(thumbnails
              .getColumnIndex(Thumbnails.DATA));
      File file = new File(path);
      if (file.delete()) {
  
          contentResolver.delete(Thumbnails.EXTERNAL_CONTENT_URI,
                  Thumbnails._ID + "=?",
                  new String[] { String.valueOf(thumbnailId) });
  
      }
  
  }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>But none of above is working for me 
  The file is deleted but the Gallery is not refreshing .
  how i can refresh the Gallery without  restarting my device . 
  or how i can refresh Gallery without Restarting my app </p>