0

I have developed a actionbar share button, however when I run the app the button does work but it crashes the application when I try to share the images with other apps. For example if I share the image with Twitter or message the application just crashes and says that "Twitter or Message has crashed.

Maddie_J
  • 171
  • 3
  • 15

1 Answers1

1

EXTRA_STREAM is supposed to hold a content: Uri.

In practice, you can often use a file: Uri pointing to a file on external storage, though that will be a problem more and more as time goes along.

You are trying to use android.resource:. Few apps support android.resource: Uri values in general, let alone for EXTRA_STREAM.

Your choices are:

  1. Write the resources out to files, then use FileProvider or perhaps file: Uri values

  2. Use my StreamProvider to serve your resources via content: Uri values

  3. Do not attempt to share resources

Beyond that, also note that your android.resource Uri seems rather mangled, as you seem to have a newline character and the literal string "getPackageName()" as part of the value.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491