How to get Bitmap from an Uri?

前端 未结 16 1371
时光说笑
时光说笑 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 10:59

    You can retrieve bitmap from uri like this

    Bitmap bitmap = null;
    try {
        bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), imageUri);
    } catch (IOException e) {
        e.printStackTrace();
    }
    

提交回复
热议问题