Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static boolean tryToSaveBitmap(Bitmap bitmap, String savePath) { FileOutputStream output = null; try { output = new FileOutputStream(savePath); return bitmap.compress(Bitmap.CompressFormat.PNG, 100, output); } catch (IOException ioe) { // do nothing } finally { try { if (output != null) { output.flush(); output.close(); } } catch (Exception e) { // ignore... } } return false; } }