Failed to save image to sdcard
<p>I try to download an image with this code and save it :
in this line:</p>

<pre><code>OutputStream os =new FileOutputStream(f);
</code></pre>

<p>i try it on the emulator.my app get exception that there is no permission to save to this path:</p>

<pre><code>java.io.FileNotFoundException: /mnt/sdcard/InterFlora/1221618532: open failed: EACCES (Permission denied)
</code></pre>

<p>i also add this line :</p>

<pre><code>&lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /&gt;
</code></pre>

<p>this is the code:</p>

<pre><code>   RetreiveImage extends AsyncTask&lt;String, Void,Bitmap&gt; {
           Item m_item;
           File f;

           public RetreiveImage(Item aItem , File aFile){
               m_item = aItem;
               f = File (m_Sdcard.getAbsolutePath() + "/myFolder");
           }

        @Override
        protected Bitmap doInBackground(String... params) {

        try
        {
            Bitmap bitmap=null;
            InputStream is=new URL(m_item.small).openStream();
            OutputStream os =new FileOutputStream(f);
            os.close();

            return bitmap;
        }
        catch (MalformedURLException e) {
            return null;
        } catch (IOException e) {
            return null;
        }
    }
}
</code></pre>

<h1>Edit</h1>

<pre><code>File m_Sdcard = Environment.getExternalStorageDirectory();
File cacheDir =new File (m_Sdcard.getAbsolutePath() + "/MyFolder");
if(!cacheDir.exists())
cacheDir.mkdirs();
</code></pre>
