Java tutorial
//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()); } }