Java tutorial
//package com.java2s; //License from project: Open Source License import android.graphics.Bitmap; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void savePic(File targetFile, Bitmap bitmap) throws IOException { if (!targetFile.getParentFile().exists()) { targetFile.getParentFile().mkdirs(); } else if (!targetFile.exists()) { targetFile.createNewFile(); } else { FileOutputStream fos = new FileOutputStream(targetFile); bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos); } } }