title: FileObserver in Java (Android) triggered multiple times
body: <p>I have implemented a file observer on a folder observing for the create &amp; delete as follows:</p>
  
  <pre><code>private FileObserver getFileObserverListener(String filepath, String fileType) {
      return new FileObserver(filepath) {
        @Override
        public void onEvent(int i, @Nullable String s) {
          if ((FileObserver.CREATE &amp; i) != 0 || (FileObserver.DELETE &amp; i) != 0) {
            refreshFolderData(filepath, fileType);
          }
        }
      };
    }
  </code></pre>
  
  <p>But when I am creating/deleting multiple files in a single batch, the file observer is triggered for every single delete/create operation. Is there a way to avoid this? More specifically, is there a way to trigger the file observer exactly once for a batch of create/delete operations in a particular folder?</p>