title: Android scanFile() on empty directory
body: <p>When you create a file in android, you have to call MediaScannerConnection.scanFile() on it, so that it gets displayed in the file explorer.</p>
  
  <p>However, when I try to do this with a directory it gets treated as a file.</p>
  
  <pre><code>File dir = new File("folder/subfolder/folder2");
  dir.mkdirs();
  MediaScannerConnection.scanFile(_context, new String[]{dir.getAbsolutePath()}, null, null);
  </code></pre>
  
  <p><strong>"folder2" should be a directory not a file.</strong> How can I fix this?</p>
  
  <p><a href="https://i.stack.imgur.com/sNHro.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/sNHro.png" alt="&quot;folder2&quot; should be a directory not a file"></a></p>