Java tutorial
//package com.java2s; import android.graphics.Bitmap; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static boolean tryToSaveBitmap(Bitmap bitmap, String savePath) throws IOException { FileOutputStream output = new FileOutputStream(savePath); try { return bitmap.compress(Bitmap.CompressFormat.PNG, 100, output); } finally { try { output.flush(); output.close(); } catch (Exception e) { // ignore... } } } }