Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Open Source License 

import java.io.File;

import java.io.FileOutputStream;

import android.graphics.Bitmap;

public class Main {
    public static String SaveBitmap(Bitmap bmp, String name) {
        File file = new File("mnt/sdcard/picture/");
        String path = null;
        if (!file.exists())
            file.mkdirs();
        try {
            path = file.getPath() + "/" + name;
            FileOutputStream fileOutputStream = new FileOutputStream(path);

            bmp.compress(Bitmap.CompressFormat.JPEG, 100, fileOutputStream);
            fileOutputStream.flush();
            fileOutputStream.close();
            System.out.println("saveBmp is here");
        } catch (Exception e) {
            e.printStackTrace();
        }

        return path;
    }
}