Here you can find the source of saveBitmap(Bitmap bitmap, File file)
public static File saveBitmap(Bitmap bitmap, File file) throws IOException
//package com.java2s; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import android.graphics.Bitmap; public class Main { public static File saveBitmap(Bitmap bitmap, File file) throws IOException { ByteArrayOutputStream bytes = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, bytes); //write the bytes in file FileOutputStream fo = new FileOutputStream(file); fo.write(bytes.toByteArray());//from w ww.j av a 2s . c om // remember close de FileOutput fo.close(); return file; } }