Retrieve bitmap from uri

前端 未结 7 1718
终归单人心
终归单人心 2021-01-01 17:06

I have included \'share via myApp\' option. I inserted following code in the receiving activity class.

    // Get the intent that started this activity
    I         


        
7条回答
  •  自闭症患者
    2021-01-01 17:43

    As you have already get the Uri. Now you have to pass that Uri in getBitmap() to get bitmap and use that bitmap.

    Uri imageUri = intent.getData();
    Bitmap bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(),imageUri);
    Imageview my_img_view = (Imageview ) findViewById (R.id.my_img_view);
    my_img_view.setImageBitmap(bitmap);
    

提交回复
热议问题