problems saving & opening a BitMap file
<p>In this code I'm trying to:</p>

<ol>
<li>get a bitmap from an ImageView</li>
<li>save it as "er.png"</li>
<li>then load it and assign it to another ImageView</li>
</ol>

<p>here's my code... but it keeps firing the exception that it can't write... any ideas what might be causing it? Maybe it needs some permissions?</p>

<pre><code>////// GET FROM IV /////////////////////////////////////
        ImageView iv = (ImageView)findViewById(R.id.ivDon);
        Drawable draw = iv.getBackground();
        Bitmap bm = ((BitmapDrawable)draw).getBitmap();
        Bitmap bmHue = Hue(bm,180);

        //////////////////////////// SAVE ///////////
        Bitmap bbicon = bmHue;

        String extStorageDirectory = Environment.getExternalStorageDirectory().toString();
        OutputStream outStream = null;
        File file = new File(extStorageDirectory, "er.PNG");
        try {
         outStream = new FileOutputStream(file);
         bbicon.compress(Bitmap.CompressFormat.PNG, 100, outStream);
         outStream.flush();
         outStream.close();
        }
        catch(Exception e)
        {Toast.makeText(this, "error writing :/", 5000).show();} // &lt;- this exception fires.

        ///////////////////////////// LOAD //////////////  
        java.io.FileInputStream in = null;
        try {
            in = openFileInput("er.PNG");
        } catch (FileNotFoundException e)
        {Toast.makeText(this, "error reading :/", 5000).show();}

        ////////////////////////////// ASSIGN ///////////////
        ImageView iv1 = (ImageView)findViewById(R.id.iv01);
        iv1.setImageBitmap(BitmapFactory.decodeStream(in));
</code></pre>

<p>Thanks!</p>
