Ama*_*nni 10 android android-intent
我需要知道是否可以仅使用具有共享意图的URL来共享图像.这是我的代码.
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);
Run Code Online (Sandbox Code Playgroud)
到目前为止,它没有工作,我没有在网上找到任何有用的答案.我想使用共享意图并且不下载图像来执行此操作.
Nit*_*sra 22
您可以使用共享意图共享图像,但您必须将图像解码为本地化的位图
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..."));
Run Code Online (Sandbox Code Playgroud)
loadedImage是来自http://eofdreams.com/data_images/dreams/face/face-03.jpg的加载位图
| 归档时间: |
|
| 查看次数: |
25194 次 |
| 最近记录: |