title: getExternalFilesDir NOT creating new Directory
body: <p>I am trying to CHECK to see if a Subdirectory Structure on the SD Card Exists;<br>
  If NOT then CREATE a new one.<br>
  That is of course AFTER my code verified that the SD Card is mounted and ready.  </p>
  
  <p>I created code that WORKED, and I successfully created the structure ON MY CELL PHONE'S SD Card, so I know my code was good.  I then went to bed.  The next day, I MOVED the working code from my TEST area to my WORKING area and now it won’t work!!  :-(  I even MOVED it Back to the test area and Still no workie!! </p>
  
  <p>I'm guessing that at night the Android Gremlins did something to break the code!! </p>
  
  <p>So...either the Android Gremlins did something OR perhaps (and this is a long shot) I might have forgotten something when I moved the code.   Does anybody have any Gremlin repellent??  </p>
  
  <p>I’m pretty sure the code that WORKED and actually created the structure that I CAN NOW SEE on my phone was something like this:</p>
  
  <hr>
  
  <pre><code>String strPathName = m_Context.getExternalFilesDir (null) .toString ();
  // This DOES give the Correct Path on the SD Card
  
  File dir;  
  
  dir = new File (m_Context.getExternalFilesDir (null) + "/MyDirectory");  
  dir = new File (m_Context.getExternalFilesDir (null) + "/MyDirectory/SubDir");  
  dir = new File (m_Context.getExternalFilesDir (null) + "/MyDirectory/SubDir/xxx");  
  </code></pre>
  
  <p>On my Cell Phone, I can clearly see this structure.  It is still there now!!  </p>
  
  <p>The next day, (i.e. AFTER a visit from the Android Gremlins) I attempted to MOVE this and other code FROM my Test area to a different section and after that, it no longer would CREATE a structure.  </p>
  
  <h2>I step thru with the De-Bugger (i.e. Gremlin Killer) and here is what happens.</h2>
  
  <pre><code>File dir;  
  boolean bDirExists;  
  
  dir = new File (m_Context.getExternalFilesDir (null) + "/NewDirectory");  
  bDirExists = (dir.exists () &amp;&amp; dir.isDirectory () );  // FALSE  
  
  dir = new File (m_Context.getExternalFilesDir (null) + "/NewDirectory/SubDir");  
  bDirExists = (dir.exists () &amp;&amp; dir.isDirectory () );   // FALSE  
  bDirExists = dir.exists ();                                                     // FALSE  
  bDirExists = dir.isDirectory ();                                            // FALSE  
  
  dir = new File (m_Context.getExternalFilesDir (null) + "/NewDirectory/SubDir/xxx");  
  bDirExists = (dir.exists () &amp;&amp; dir.isDirectory () );   // FALSE  
  </code></pre>
  
  <p>IF…. I use the original name that I used the previous day "/MyDirectory/SubDir/xxx")<br>
  THEN the code indicates that the Directory DOES EXIST</p>
  
  <pre><code>dir = new File (m_Context.getExternalFilesDir (null) + "/MyDirectory");  
  bDirExists = (dir.exists () &amp;&amp; dir.isDirectory () );   // TRUE  
  
  dir = new File (m_Context.getExternalFilesDir (null) + "/MyDirectory/SubDir");  
  bDirExists = (dir.exists () &amp;&amp; dir.isDirectory () );   // TRUE  
  bDirExists = dir.exists ();   // TRUE  
  bDirExists = dir.isDirectory ();   // TRUE  
  </code></pre>
  
  <p>Now… as we ALL KNOW, programmers NEVER break their code and NEVER introduce errors into “known to be working code” so…. It MUST be Gremlins…. Right??  </p>
  
  <hr>
  
  <h2>First Update</h2>
  
  <p>@ChuongPham commented that I may need to add the correct Permission in the Manifest file.</p>
  
  <p>Since the code DID WORK, it means that I DID already enable this permission.<br>
  However, I decided to REMOVE this permission and see what ERROR it would throw, I thought it would not compile without the permission.  I then ran the code and NO ERROR was thrown!!  And YES, it still will NOT create a new file..</p>