嗨,有人可以帮我吗?我被困住了,找不到答案
selectedPhotoUri = data.data
val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, selectedPhotoUri)
selectphoto_imageview_register.setImageBitmap(bitmap)
val bitmapDrawable = BitmapDrawable(bitmap)
selectPhoto_button_register.setBackgroundDrawable(bitmapDrawable)
具体来说,我收到此错误:
'getBitmap(ContentResolver !, Uri!):位图!'不推荐使用。在Java中已弃用
答案 0 :(得分:-1)
代替
val bitmap = MediaStore.Images.Media.getBitmap(contentResolver, selectedPhotoUri)
selectphoto_imageview_register.setImageBitmap(bitmap)
您可以使用
Picasso.get()
.load(selectedPhotoUri)
.into(selectphoto_imageview_register)