Hi,

I'm trying to set up a SEND intent so that my app can share images in
a similar way to the gallery app. The only difference is that my
images are in memory rather than on the sdcard. This seems to present
a conundrum with file system permissions. Any advice appreciated.

This is how I set up the send intent. All seems to be fine:

            Uri u = Uri.fromFile(local_file);
            Intent intent = new Intent();
            intent.setAction(Intent.ACTION_SEND);
            String mimeType = "image/jpeg";
            intent.setType(mimeType);
            intent.putExtra(Intent.EXTRA_STREAM, u);

The JPEG I want to send is in memory. In order to construct a URI to
pass to the send intent, it seems I have to write the JPEG to disk.
However, if I write the file to the local files directory of my app
using

openFileOutput("image.jpg",MODE_WORLD_READABLE);

then the activity that accepts the send request has an error when it
tries to fetch this image. I think this is because it doesn't have
read permissions on my local storage. And there is no apparent way to
give it the necessary permissions.

So that seems to leave writing the image to the sdcard. Is this
correct, or did I miss a trick somewhere? Using the sdcard as temp
storage seems like a messy solution.

Best,
Mark

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to