Here you can find the source of saveBitmap(final Bitmap bitmap, final String savePath)
public static void saveBitmap(final Bitmap bitmap, final String savePath)
import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; import java.util.Locale; import android.annotation.SuppressLint; import android.content.res.Resources; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.graphics.Matrix; import android.graphics.drawable.Drawable; import android.os.Build; import android.text.TextUtils; import android.widget.ImageView; public class Main{ private static final int DEAFULT_QUALITY = 100; public static void saveBitmap(final Bitmap bitmap, final String savePath) { FileOutputStream fileOutputStream = null; try {/* www .j a v a 2s . c om*/ fileOutputStream = new FileOutputStream(savePath); bitmap.compress(Bitmap.CompressFormat.JPEG, DEAFULT_QUALITY, fileOutputStream); fileOutputStream.flush(); } catch (Exception e) { e.printStackTrace(); } finally { try { fileOutputStream.close(); } catch (Exception e) { e.printStackTrace(); } } } }