与Android的URL份额的意图份额形象 [英] share image with URL android share intent

查看:174
本文介绍了与Android的URL份额的意图份额形象的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道是否有可能只使用其URL以每股意图分享图片。这里是我的code。

I need to know if it is possible to share an image using only its url with a share intent. Here is my code.

Intent imageIntent = new Intent(Intent.ACTION_SEND);
Uri imageUri = Uri.parse("http://eofdreams.com/data_images/dreams/face/face-03.jpg");
imageIntent.setType("image/*");
imageIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
startActivity(imageIntent);

到目前为止,它不工作,我还没有发现任何有用的答案网上。我想利用这个份额故意和无需下载影像做。

So far its not working and I haven't found any helpful answers online. I would like to do this using the share intent and without downloading the image.

推荐答案

您可以用份额的意图共享图像,但你脱code图像本地化的位图

You can share image using share intent, but you've to decode image to a localized Bitmap

Intent intent = new Intent(Intent.ACTION_SEND);
intent.putExtra(Intent.EXTRA_TEXT, "Hey view/download this image");
String path = Images.Media.insertImage(getContentResolver(), loadedImage, "", null);
Uri screenshotUri = Uri.parse(path);

intent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
intent.setType("image/*");
startActivity(Intent.createChooser(intent, "Share image via..."));

loadedImage 是的 http://eofdreams.com/data_images/dreams/face/face-03.jpg

这篇关于与Android的URL份额的意图份额形象的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆