set Internal Bitmap - Android Graphics

Android examples for Graphics:Bitmap Save

Description

set Internal Bitmap

Demo Code


//package com.java2s;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import android.content.Context;

import android.graphics.Bitmap;

public class Main {
    public static void setInternalBitmap(Context c, String filename,
            Bitmap bitmap) {//from www. j  a va 2  s  .c om

        try {
            FileOutputStream fos = c.openFileOutput(filename,
                    Context.MODE_PRIVATE);
            bitmap.compress(Bitmap.CompressFormat.JPEG, 100, fos);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
    }
}

Related Tutorials