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 android.content.Context;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.net.Uri;

import java.io.InputStream;

public class Main {
    public static Bitmap readBitmapFromPath(Context context, Uri path) throws Exception {
        InputStream stream = context.getContentResolver().openInputStream(path);
        Bitmap bitmap = BitmapFactory.decodeStream(stream);
        if (stream != null) {
            stream.close();
        }
        return bitmap;
    }
}