Java tutorial
//package com.java2s; import android.graphics.Bitmap; import android.os.Environment; import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; public class Main { public static void saveImage(Bitmap bmp, String name) { if (bmp != null) { File appDir = new File(Environment.getExternalStorageDirectory(), name); if (!appDir.exists()) { try { appDir.createNewFile(); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } try { FileOutputStream fos = new FileOutputStream(appDir); bmp.compress(Bitmap.CompressFormat.JPEG, 90, fos); fos.flush(); fos.close(); } catch (FileNotFoundException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } else { } } }