Store Bitmap from imageview to SD
<p>i am trying to save a bitmap that is displayed on an imageview. what i understand is that i need to </p>

<ol>
<li>convert bitmap to stream.</li>
<li>write that stream to a file on the sd card.</li>
</ol>

<p>here is what i have done </p>

<pre><code>try {
                   File path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
                   File file = new File(path, "name.png");
                   FileOutputStream out = null;
                   if (file.exists()) {
                       // do something awesome

                   } else {

                       out = new FileOutputStream(file);
                       currentimage.compress(Bitmap.CompressFormat.PNG, 100, out);
                   }
                   out.close();
            } catch (Exception e) {
                   e.printStackTrace();
            }
</code></pre>

<p>I am trying to change the file name saved i understand it will go in the FileOutputStream but not quite sure </p>
