Here you can find the source of saveBitmap(File saveToFile, Bitmap bitmapToSave)
public static boolean saveBitmap(File saveToFile, Bitmap bitmapToSave)
//package com.java2s; import android.graphics.Bitmap; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static boolean saveBitmap(File saveToFile, Bitmap bitmapToSave) { try {/* w w w .j a va2s. co m*/ FileOutputStream fileOutputStream = new FileOutputStream( saveToFile); bitmapToSave.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream); fileOutputStream.flush(); fileOutputStream.close(); } catch (FileNotFoundException fileNotFoundException) { fileNotFoundException.printStackTrace(); return false; } catch (IOException IOException) { IOException.printStackTrace(); return false; } return true; } }