Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import android.graphics.Bitmap;

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

public class Main {
    private static boolean tryToSaveBitmap(Bitmap bitmap, String savePath) throws IOException {
        FileOutputStream output = new FileOutputStream(savePath);
        try {
            return bitmap.compress(Bitmap.CompressFormat.PNG, 100, output);
        } finally {
            try {
                output.flush();
                output.close();
            } catch (Exception e) {
                // ignore...
            }
        }
    }
}