Here you can find the source of saveBitmapToFile(Bitmap bitmap, String path)
public static void saveBitmapToFile(Bitmap bitmap, String path)
//package com.java2s; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; public class Main { public static void saveBitmapToFile(Bitmap bitmap, String path) { CompressFormat format = Bitmap.CompressFormat.PNG; int quality = 100; OutputStream stream = null; try {/*ww w.ja v a2 s.c o m*/ File file = new File(path); if (!file.getParentFile().exists()) { file.getParentFile().mkdirs(); } stream = new FileOutputStream(path); bitmap.compress(format, quality, stream); } catch (FileNotFoundException e) { e.printStackTrace(); } finally { if (stream != null) { try { stream.close(); } catch (IOException e) { e.printStackTrace(); } } } } }