Here you can find the source of storeBitmapToFile(Bitmap bitmap, String filePath)
public static boolean storeBitmapToFile(Bitmap bitmap, String filePath)
//package com.java2s; import java.io.BufferedOutputStream; import java.io.FileOutputStream; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.os.Environment; public class Main { public static boolean storeBitmapToFile(Bitmap bitmap, String filePath) { if (Environment.getExternalStorageState().equals( Environment.MEDIA_MOUNTED)) { try { BufferedOutputStream bos = new BufferedOutputStream( new FileOutputStream(filePath)); bitmap.compress(CompressFormat.PNG, 50, bos); bos.flush();/*from w ww. j a v a 2 s . co m*/ bos.close(); } catch (Exception e) { return false; } return true; } return false; } }