简体   繁体   English

通用图像加载器与其他应用共享图像

[英]Universal image loader share images with other apps

I am using Universal Image Loader to show images in my app. 我正在使用Universal Image Loader在我的应用程序中显示图像。 There is image sharing functionality to share images with other apps. 有图像共享功能可与其他应用共享图像。

Right now I'm doing: 现在我正在做:

ImageLoader imageLoader = ImageLoader.getInstance();
File file = imageLoader.getDiskCache().get(url);
if (file != null) {
   Util.shareImage(getActivity(), file);
}

public static void shareImage(Context context, File pictureFile) {
    Uri imageUri = Uri.parse(pictureFile.getAbsolutePath());
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
    //shareIntent.setType("image/jpeg");
    shareIntent.setType("image/*");
    context.startActivity(Intent.createChooser(shareIntent, "Share"));
}

Below are the values for variables. 以下是变量的值。

在此处输入图片说明

Not sure why it's not working? 不知道为什么它不起作用?

try "static" give away 尝试“静态”放弃

public void shareImage(Context context, File pictureFile) {
 Uri imageUri = Uri.parse(pictureFile.getAbsolutePath());
    Intent shareIntent = new Intent();
    shareIntent.setAction(Intent.ACTION_SEND);
    shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri);
}

我缺少此权限,似乎需要能够共享图像

<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM