How to get Bitmap from an Uri?

前端 未结 16 1282
时光说笑
时光说笑 2020-11-22 10:41

How to get a Bitmap object from an Uri (if I succeed to store it in /data/data/MYFOLDER/myimage.png or file///data/data/MYFOLDER/myimage.png) to u

16条回答
  •  谎友^
    谎友^ (楼主)
    2020-11-22 11:07

      InputStream imageStream = null;
        try {
            imageStream = getContext().getContentResolver().openInputStream(uri);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        }
        final Bitmap selectedImage = BitmapFactory.decodeStream(imageStream);
    

提交回复
热议问题