Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import java.io.FileInputStream;

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

public class Main {
    /**
     *
     * @param path
     * @return
     */
    public static Bitmap getBitmapFromSDCard(String path) {
        FileInputStream fis = null;
        try {
            fis = new FileInputStream(path);
            if (fis != null) {
                BitmapFactory.Options options = new BitmapFactory.Options();
                options.inSampleSize = 2;
                return BitmapFactory.decodeStream(fis, null, options);
            }
        } catch (Exception e) {

        }
        return null;
    }
}