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 boolean bitmapToFile(Bitmap bmp, String fileName) {
        try {
            FileOutputStream out = new FileOutputStream(fileName);
            bmp.compress(Bitmap.CompressFormat.PNG, 90, out);
            out.close();
            File iconFile = new File(fileName);
            iconFile.setReadable(true, false);
        } catch (Exception e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }
}