android error trying to write to external SD
<p>I am trying to write a jpg image to the external SD card. However, I am getting System.err <code>FileNotFoundException: /mnt/sdcard/test.images/temp/savedImage (no such file or directory)</code>. Creating the directory also seems to fail and gives a <code>false</code> in LogCat and I also cannot see the folder when looking on my SD card.</p>

<p>My code is as follows:</p>

<pre><code>if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {   
        File folder = new File(Environment.getExternalStorageDirectory() + "/test.images/temp");
        try {
            if(!folder.exists()){
                boolean dir = new File(Environment.getExternalStorageDirectory() + "/test.images/temp").mkdir();
                Log.v("creating directory", Boolean.toString(dir));
            }
            File imageOutputFile = new File(Environment.getExternalStorageDirectory() + "/test.images/temp", "savedImage");
            FileOutputStream fos = new FileOutputStream(imageOutputFile);
            Image.compress(Bitmap.CompressFormat.JPEG, 100, fos);
            fos.close();
        } catch (Exception e) {
            e.printStackTrace();
        }
 }
</code></pre>

<p>I have permission <code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/&gt;
</code> in the manifest and have cleaned and rebuilt.</p>
