Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void writeBitmapToFile(Bitmap bitmap, File file) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); bitmap.compress(Bitmap.CompressFormat.PNG, 100, bos); byte[] bitmapData = bos.toByteArray(); //write the bytes in file FileOutputStream fos = new FileOutputStream(file); fos.write(bitmapData); fos.flush(); fos.close(); } }