Java tutorial
//package com.java2s; //License from project: Open Source License import java.io.File; import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import android.graphics.Bitmap; import android.os.Environment; public class Main { public static void saveMyBitmap3(String bitName, Bitmap mBitmap) throws IOException { String myJpgPath = Environment.getExternalStorageDirectory() + "/pepper/" + "3.png"; File tmp = new File("/sdcard/pepper/"); if (!tmp.exists()) { tmp.mkdir(); } File f = new File(myJpgPath); f.createNewFile(); FileOutputStream fOut = null; try { fOut = new FileOutputStream(f); } catch (FileNotFoundException e) { e.printStackTrace(); } mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut); try { fOut.flush(); fOut.close(); } catch (IOException e) { e.printStackTrace(); } } }