1

Sorry for repeated question. I searched a lot on the Internet, got a lot of links too. But none of it worked correctly.

I've an Image in a drawable folder. Wanted to share t via apps like Gmail, Messaging etc. How's it possible? I used the following code:

shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("android.resource://" + getPackageName() + "/" + R.drawable.myImage));

But this stop the "com.android.mms" what to do?

Also, is any permission required to be added? Or am I missing out anything? Does this sharing work on Android 2.2, cause I'm testing on it?

Sam
  • 822
  • 2
  • 8
  • 30

1 Answers1

2

you have to store your image to the internal/external storage first, then you can be able to share it by using Gmail, ....

More info in comments

Community
  • 1
  • 1
Alex
  • 688
  • 6
  • 8
  • I used shareIntent.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///"+Environment.getExternalStorageDirectory()+"/myImage.png")); But it says, file Not found :( – Sam Jan 29 '14 at 14:48
  • Problem is that image doesn't get attached using this code, as you mentioned in link – Sam Jan 29 '14 at 14:52
  • Did you copy the image from resources to external storage first? Do you have correct path to that image? – Alex Jan 29 '14 at 14:53
  • Sorry, but how can that be achieved? – Sam Jan 29 '14 at 14:56
  • http://stackoverflow.com/a/10561536/1876084, you'll have to change the image name. Also you can see the whole code there – Alex Jan 29 '14 at 14:58