Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/178.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android 通用图像加载器与其他应用程序共享图像_Android_Image_Android Intent_Sharing_Universal Image Loader - Fatal编程技术网

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

Android 通用图像加载器与其他应用程序共享图像,android,image,android-intent,sharing,universal-image-loader,Android,Image,Android Intent,Sharing,Universal Image Loader,我正在使用通用图像加载器在我的应用程序中显示图像。有图像共享功能,可与其他应用共享图像 现在我正在做: ImageLoader imageLoader = ImageLoader.getInstance(); File file = imageLoader.getDiskCache().get(url); if (file != null) { Util.shareImage(getActivity(), file); } public static void shareImage(Co

我正在使用通用图像加载器在我的应用程序中显示图像。有图像共享功能,可与其他应用共享图像

现在我正在做:

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"));
}
下面是变量的值

不确定它为什么不工作?试试“静态”赠送

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);
}
尝试“静态”赠送

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" />

我缺少共享图像所需的权限

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