Android Bitmap Create getBitmapFromURI(Context context, Uri uri)

Here you can find the source of getBitmapFromURI(Context context, Uri uri)

Description

get Bitmap From URI

License

Apache License

Declaration

public static Bitmap getBitmapFromURI(Context context, Uri uri) 

Method Source Code

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

import android.content.Context;

import android.graphics.Bitmap;

import android.net.Uri;
import android.provider.MediaStore;

import java.io.IOException;

public class Main {
    public static Bitmap getBitmapFromURI(Context context, Uri uri) {
        try {/*from   w  w  w.ja  v a2 s  .  c  o  m*/
            Bitmap bitmap = MediaStore.Images.Media.getBitmap(
                    context.getContentResolver(), uri);

            return bitmap;
        } catch (IOException e) {
            throw new IllegalArgumentException(
                    "Error creating bitmap from URI");
        }
    }
}

Related

  1. createCompatibleImage(BufferedImage image, int width, int height)
  2. getBitMapFromStream(String filename)
  3. getBitmap(int resId, Context ctx)
  4. getBitmapFromImageView(ImageView theImage)
  5. getBitmapFromResource(Resources resources, int resourceId, int reqWidth, int reqHeight)
  6. getBackground(int bgcolor)
  7. makeBitmap(int minSideLength, int maxNumOfPixels, Uri uri, ContentResolver cr, ParcelFileDescriptor pfd, BitmapFactory.Options options)
  8. generateBitmap(int width, int height)