Android Bitmap Save saveBitmapAsJpgAtSd(Bitmap mBitmap, String dirPath, String fileName)

Here you can find the source of saveBitmapAsJpgAtSd(Bitmap mBitmap, String dirPath, String fileName)

Description

save Bitmap As Jpg At Sd

Declaration

public static void saveBitmapAsJpgAtSd(Bitmap mBitmap, String dirPath,
        String fileName) throws IOException 

Method Source Code

//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();
    }
}

Related

  1. saveBitmapToFile(Bitmap bitmap, String filename)
  2. saveBitmap(Bitmap bmp, String path, CompressFormat format)
  3. saveBitmap(Bitmap image)
  4. saveBitmap(File file, Bitmap bitmap)
  5. saveBitmap(File saveToFile, Bitmap bitmapToSave)
  6. saveBitmapFromView(View view, String path)
  7. saveBitmapJPEGWithBackgroundColor( String strFileName, Bitmap bitmap, int nQuality, int nBackgroundColor)
  8. saveBitmapPNGWithBackgroundColor( String strFileName, Bitmap bitmap, int nBackgroundColor)
  9. saveBitmapToPath(Context ctxt, String path, String filename, Bitmap bm)