本文介绍了从 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 中检索位图
发布评论