且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

将uri传递到另一个活动并将其转换为图像

更新时间:2022-12-19 10:28:44

将您 URI 转换为String,同时添加到如下所示的 Intent

Convert you URI to String while adding to Intent like given below

i.putExtra("imagePath", selectedImage.toString());

,然后在您的 NextActivity 中获取 String ,然后像->

and in your NextActivity get the String and convert back to URI like ->

Intent intent = getIntent(); 
String image_path= intent.getStringExtra("imagePath"); 
Uri fileUri = Uri.parse(image_path) 
imageview.setImageURI(fileUri)