[Android] Problems sharing combined text and image with SHARE INTENT on Twitter


Answers

You can still try with ACTION_SEND, without using the ACTION_SEND_MULTIPLE.

ACTION_SEND_MULTIPLE resulted in a force close, when I tried to create new intents for sharing to Gmail, G+, etc.

This worked perfect for me:

    Intent shareIntent = new Intent(Intent.ACTION_SEND);
    Uri uri = Uri.parse("file:///sdcard/image.jpg");
    shareIntent.setType("*/*");
    shareIntent.putExtra(Intent.EXTRA_TEXT, "Body text of the new status");
    shareIntent.putExtra(Intent.EXTRA_STREAM, uri);
    return shareIntent; 
Question

I want to give the user the possibility to share a Image and a Text with Twitter and Facebook.

Actually my code can launch Android's share intent and if the user selects Facebook, all works fine, the Image is attached and the text is shown on the body of the new status.

But something is wrong with Twitter, if i only put a Image all works fine, the image is detected by twitter and automatically uploaded to twipic, then twitter posts the link of the image on the tweet. But if i put a image and a text, then, twitter doesn't detect the image and it only puts the text on the tweet, the image is ignored. What is wrong?

this is my code:

Intent sharingIntent = new Intent(Intent.ACTION_SEND);
Uri screenshotUri = Uri.parse("file:///sdcard/image.jpg");
sharingIntent.setType("image/*");
sharingIntent.putExtra(Intent.EXTRA_TEXT, "Body text of the new status");
sharingIntent.putExtra(Intent.EXTRA_STREAM, screenshotUri);
startActivity(Intent.createChooser(sharingIntent, "Share image using"));



Links