从uri检索位图

编程入门 行业动态 更新时间:2024-10-24 12:27:02
本文介绍了从uri检索位图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我加入了通过myApp共享"选项.我在接收活动类中插入了以下代码.

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

// Get the intent that started this activity Intent intent = getIntent(); Uri data = intent.getData(); // Figure out what to do based on the intent type if (intent.getType().indexOf("image/") != -1) { // Handle intents with image data ... }

检索位图图像的下一步是什么.

What is the next step to retrieve bitmap image.

推荐答案

您已经获得了Uri.现在,您必须在getBitmap()中传递该Uri以获得位图并使用该位图.

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);

更多推荐

从uri检索位图

本文发布于:2023-10-26 09:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1529795.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:位图   uri

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!