Here you can find the source of saveBitmapAsJpgAtSd(Bitmap mBitmap, String dirPath, String fileName)
public static void saveBitmapAsJpgAtSd(Bitmap mBitmap, String dirPath, String fileName) throws IOException
//package com.java2s; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import android.graphics.Bitmap; import android.graphics.Bitmap.CompressFormat; import android.os.Environment; public class Main { public static void saveBitmapAsJpgAtSd(Bitmap mBitmap, String dirPath, String fileName) throws IOException { String fullPath = Environment.getExternalStorageDirectory() .toString() + "/" + dirPath + "/" + fileName; FileOutputStream fos = null; File file = new File(fullPath); file.getParentFile().mkdirs(); /*from w w w .ja v a 2 s. c o m*/ fos = new FileOutputStream(file); mBitmap.compress(CompressFormat.JPEG, 100, fos); fos.close(); } }