Android Bitmap Save saveMyBitmap(String bitName, Bitmap mBitmap)

Here you can find the source of saveMyBitmap(String bitName, Bitmap mBitmap)

Description

save My Bitmap

Declaration

public static void saveMyBitmap(String bitName, Bitmap mBitmap) 

Method Source Code

//package com.java2s;
import java.io.File;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

import android.graphics.Bitmap;

public class Main {
    public static void saveMyBitmap(String bitName, Bitmap mBitmap) {
        File f = new File(bitName);
        try {/* ww  w  .  j a va2 s . c  om*/
            f.createNewFile();
        } catch (IOException e1) {
            e1.printStackTrace();
        }
        FileOutputStream fOut = null;
        try {
            fOut = new FileOutputStream(f);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        mBitmap.compress(Bitmap.CompressFormat.PNG, 100, fOut);
        try {
            fOut.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }
        try {
            fOut.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}

Related

  1. saveBitmap(final Bitmap bitmap, final String savePath)
  2. saveBitmapFromScrollView(ScrollView scrollView, String path)
  3. saveBitmaptoFile(Bitmap bmp, String path, CompressFormat format, int quality)
  4. saveImage(String filename, Bitmap bm)
  5. saveImage(String filename, Bitmap bm, boolean landscape)
  6. saveToLocal(Bitmap bmp, String fileName)
  7. storeImage(Context context, Bitmap image)
  8. saveBitmap(Bitmap bitmap, String filename)
  9. saveBitmap2SD(Bitmap bitmap, Context context, String filePath, String fileName)