title: getExternalFilesDir(null) returns null
body: <p>Once again, I've come up against a question which has been asked and answered before but in my implementation it is still not working.</p>
  
  <p>I'm calling <strong>getExternalFilesDir(null)</strong> right at the very start of my main activity's <strong>onCreate</strong> method. It returns null every time, whether I run it in an AVD or on my phone (Samsung Galaxy Plus).</p>
  
  <p>Yes, I have the <code>&lt;uses-permission android:name="android.permissions.WRITE_EXTERNAL_STORAGE" /&gt;</code> line in my <strong>AndroidManifest.xml</strong> and yes, I am checking the external storage state before I make the call and it is mounted.</p>
  
  <p>Here are the first three lines inside my <strong>onCreate()</strong> method. Actually, it's just after the <strong>super.onCreate()</strong> and <strong>setContentView()</strong> calls.</p>
  
  <pre><code>String state = Environment.getExternalStorageState();
  File extFiles = getExternalFilesDir(null);
  File locFiles = getFilesDir();
  </code></pre>
  
  <p>So, once these three lines have executed, these are the values for the variables:</p>
  
  <pre><code>state == "mounted"
  extFiles == null
  locFiles == "/data/data/com.mypackage.name/files"
  </code></pre>
  
  <p>Would anyone have any ideas as to why this might be?</p>
  
  <p><strong>-----EDIT-----</strong></p>
  
  <p>So I've tried another approach; Rather than using <code>getExternalFilesDir(null)</code>, I tried using <code>File basePath = new File(Environment.getExternalStorageDirectory(), "myAppName");</code></p>
  
  <p>This is not ideal and I know that the Android documentation says, and I agree with it, that you should rather use <code>getExternalFilesDir()</code>. Seeing as that's not working for me though I had to try something else. This time the function does return a valid File object so, after the above line, the path of basePath is <strong>/mnt/sdcard/myAppName</strong>. So far, so good. When I check with DDMS I can see that <strong>/mnt/sdcard</strong> exists but not <strong>/mnt/sdcard/myAppName</strong>. This is to be expected. So I call <code>boolean result = basePath.mkdirs();</code></p>
  
  <p>But this returns false and when I check on the file system I can confirm that the myAppName subfolder has not been created. When I create the folder manually through DDMS and put files in it, I can read those files from my application but I can't write anything in that folder.</p>
  
  <p>Please help! I'm at my wit's end.</p>