Save Bitmap into File and return File having bitmap image
<p>I have a problem to save Bitmaps into files.
My method is like this:</p>

<pre><code>private File savebitmap(Bitmap bmp) {
    String extStorageDirectory = Environment.getExternalStorageDirectory()
            .toString();
    OutputStream outStream = null;

    File file = new File(bmp + ".png");
    if (file.exists()) {
        file.delete();
        file = new File(extStorageDirectory, bmp + ".png");
        Log.e("file exist", "" + file + ",Bitmap= " + bmp);
    }
    try {
        outStream = new FileOutputStream(file);
        bmp.compress(Bitmap.CompressFormat.PNG, 100, outStream);
        outStream.flush();
        outStream.close();
    } catch (Exception e) {
        e.printStackTrace();
    }
    Log.e("file", "" + file);
    return file;

}
</code></pre>

<p>It gives me error of file.I am calling this method like this:</p>

<pre><code>Drawable d = iv.getDrawable();
Bitmap bitmap = ((BitmapDrawable) d).getBitmap();
File file = savebitmap(bitmap);
</code></pre>

<p>Please help me...</p>
