Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.io.File;

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

import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;

public class Main {
    public static void saveBitmapToFile(Bitmap bitmap, File file) {

        try {
            BufferedOutputStream bStream = new BufferedOutputStream(new FileOutputStream(file));
            bitmap.compress(CompressFormat.JPEG, 100, bStream);
            bStream.flush();
            bStream.close();
            bitmap.recycle();
        } catch (IOException e) {
            // Log.d(TAG, e.toString());
        }
    }
}