Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

import java.io.FileOutputStream;

import android.graphics.Bitmap;

import android.graphics.Bitmap.CompressFormat;

public class Main {
    public static String saveToFile(String filename, Bitmap bmp) {
        try {
            FileOutputStream out = new FileOutputStream(filename);
            bmp.compress(CompressFormat.PNG, 100, out);
            out.flush();
            out.close();

            return filename;
        } catch (Exception e) {
            e.printStackTrace();
            return "";
        }
    }
}