title: Can't create External Files Dir in Android. WRITE_EXTERNAL_STORAGE is present
body: <p>I tried using both my <code>ApplicationContext</code> and my calling <code>Service</code>'s <code>Context</code> to access the external directory. Unfortunately, it keeps returning <code>null</code>, and LogCat reports it was unable to create the external directory. I'm sure I have the <code>WRITE_STORAGE_PERMISSION</code> present, but it still won't work. My device is running API 10 (2.3.3) vanilla android. Any ideas?</p>
  
  <p>Here's my manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
  package="droid.signboard" android:versionCode="1"
  android:versionName="1.0"&gt;
  &lt;uses-sdk android:minSdkVersion="10" android:targetSdkVersion="10" /&gt;
  
  
  &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.CHANGE_WIFI_STATE" /&gt;
  &lt;uses-permission android:name="android.permission.INTERNET" /&gt;
  &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
  
  
  
  &lt;application android:icon="@drawable/icon" android:label="@string/app_name"
      android:name="SignboardApp"&gt;
      &lt;receiver android:name=".ApplicationStarter"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.BOOT_COMPLETED"&gt;&lt;/action&gt;
              &lt;action android:name="droid.signboard.LAUNCHER_START"&gt;&lt;/action&gt;
          &lt;/intent-filter&gt;
      &lt;/receiver&gt;
      &lt;activity android:label="@string/app_name"
          android:screenOrientation="landscape" android:launchMode="singleTop"
          android:name=".view.Signboard"&gt;
          &lt;intent-filter&gt;
              &lt;action android:name="android.intent.action.MAIN"&gt;&lt;/action&gt;
              &lt;category android:name="android.intent.category.LAUNCHER"&gt;&lt;/category&gt;
          &lt;/intent-filter&gt;
      &lt;/activity&gt;
      &lt;service android:name=".controller.MasterControllerService"&gt;
          &lt;intent-filter&gt;
              &lt;action
                  android:name="droid.signboard.LAUNCH_SERVICE_FROM_ACTIVITY"&gt;&lt;/action&gt;
          &lt;/intent-filter&gt;
      &lt;/service&gt;
  
  
  &lt;/application&gt;
  &lt;/manifest&gt;
  </code></pre>
  
  <p>and here's where the code messes up:</p>
  
  <pre><code>private boolean canWriteEx () {
  
      String state = Environment.getExternalStorageState ();
  
      if (state.equals (Environment.MEDIA_MOUNTED)) {
          Log.i (TAG, "Can write to external directory: "
                  + context.getExternalFilesDir (null).getAbsolutePath ());
          return true;
      } else {
          Log.i (TAG, "Cannot write to external directory: "
                  + context.getExternalFilesDir (null).getAbsolutePath ());
          return false;
      }
  }
  </code></pre>
  
  <p>The code is a method of a <code>Runnable</code>, that is called by a <code>Service</code>. The constructor of the <code>Runnable</code> takes a <code>Context</code> as its parameter. That is the <code>Context</code> used by the code. The code throws an exception at the Log call that <strong><em>succeeds</em></strong>, implying that external storage is present and available.</p>
  
  <p><strong>UPDATES OF ATTEMPTED FIXES:</strong></p>
  
  <p>A clean install doesn't work.<br>
  Reverting down to API 9 doesn't work, though it worked earlier.</p>