Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; import android.graphics.Bitmap; import java.io.FileOutputStream; import java.io.IOException; public class Main { private static void blockingStoreBitmap(Context context, Bitmap bitmap, String filename) { FileOutputStream fOut = null; try { fOut = context.openFileOutput(filename, Context.MODE_PRIVATE); bitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); fOut.flush(); fOut.close(); } catch (Exception e) { e.printStackTrace(); } finally { try { if (fOut != null) { fOut.close(); } } catch (IOException e) { e.printStackTrace(); } } } }