Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.graphics.Bitmap;

import android.graphics.BitmapFactory;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;

public class Main {
    /**
     *
     * @param path
     * @return
     */
    public static Bitmap returnBmpByPath(String path) {
        Bitmap bitmap = null;
        File file = new File(path);
        try {
            if (file.exists()) {
                FileInputStream is = new FileInputStream(file);
                bitmap = BitmapFactory.decodeStream(is);
                is.close();
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        //Log.v(tag, bitmap.toString());

        return bitmap;

    }
}