How to get Bitmap from an Uri?

前端 未结 16 1125
时光说笑
时光说笑 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:54

    Inset of getBitmap which is depricated now I use the following approach in Kotlin

    PICK_IMAGE_REQUEST ->
        data?.data?.let {
            val bitmap = BitmapFactory.decodeStream(contentResolver.openInputStream(it))
            imageView.setImageBitmap(bitmap)
        }
    

提交回复
热议问题