Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Bitmap.CompressFormat;

import java.io.FileOutputStream;

public class Main {
    public static void writeBitmapFile(Context context, Bitmap bmp, String pathStr) {

        if (pathStr != null) {
            FileOutputStream fos = null;
            try {
                fos = new FileOutputStream(pathStr);
                if (bmp != null && fos != null) {
                    bmp.compress(CompressFormat.JPEG, 100, fos);
                }
                fos.close();
            } catch (Exception e) {

                e.printStackTrace();
            }
        }
    }
}