Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import android.content.Context;

import android.graphics.drawable.Drawable;

import android.net.Uri;

import java.io.FileNotFoundException;

import java.io.InputStream;

public class Main {
    public static Drawable getDrawableFromUri(Uri uri, Context context) throws FileNotFoundException {
        InputStream inputStream = context.getContentResolver().openInputStream(uri);
        return Drawable.createFromStream(inputStream, uri.toString());
    }
}