get Internal Bitmap - Android Graphics

Android examples for Graphics:Bitmap Save

Description

get Internal Bitmap

Demo Code


//package com.java2s;
import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileNotFoundException;

import android.content.Context;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;

public class Main {
    public static Bitmap getInternalBitmap(Context c, String filename) {
        Bitmap b = null;/*from  w  w w . j a v  a  2  s .c o  m*/
        try {
            FileInputStream fis = c.openFileInput(filename);
            BufferedInputStream buf = new BufferedInputStream(fis);
            b = BitmapFactory.decodeStream(buf);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        return b;
    }
}

Related Tutorials