Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static boolean saveBitmap(Bitmap bitmap, File file, int quality) { if (bitmap == null) return false; FileOutputStream fos = null; try { fos = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, quality, fos); fos.flush(); return true; } catch (Exception e) { e.printStackTrace(); } finally { if (fos != null) { try { fos.close(); } catch (IOException e) { e.printStackTrace(); } } } return false; } }