Reputation: 13143
I am using Universal Image Loader to show images in my app. 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?
Upvotes: 1
Views: 297
Reputation: 13143
I was missing this permission which seems to be required to be able to share images
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
Upvotes: 0
Reputation: 29
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);
}
Upvotes: 0