Java tutorial
//package com.java2s; //License from project: Apache License import android.graphics.Bitmap; import android.os.Environment; import java.io.File; import java.io.FileOutputStream; import java.util.Random; public class Main { public static void saveBitmapToSD(Bitmap bitmap) { String root = Environment.getExternalStorageDirectory().toString(); File myDir = new File(root + "/Download"); myDir.mkdirs(); Random generator = new Random(); String fname = "Image-" + System.currentTimeMillis() + ".jpg"; File file = new File(myDir, fname); if (file.exists()) file.delete(); try { FileOutputStream out = new FileOutputStream(file); bitmap.compress(Bitmap.CompressFormat.JPEG, 90, out); out.flush(); out.close(); } catch (Exception e) { e.printStackTrace(); } } }