1

As all we known, share intent is very limited with facebook, on facebook you only can share urls, you cannot share text and cannot share images, only urls.

Intent sendIntent = new Intent();
sendIntent.setAction(Intent.ACTION_SEND);
sendIntent.putExtra(Intent.EXTRA_TEXT, "http://test.com");
sendIntent.setType("text/plain");
startActivity(Intent.createChooser(sendIntent, getResources().getText(R.string.send_to)));

if you try this with facebook, it does not work:

Intent shareIntent = new Intent();
shareIntent.setAction(Intent.ACTION_SEND);
shareIntent.putExtra(Intent.EXTRA_STREAM, uriToImage);
shareIntent.setType("image/jpeg");
startActivity(Intent.createChooser(shareIntent, getResources().getText(R.string.send_to)));

But... how its possible that i can share a image from my official android gallery on facebook?

I'm sure there is a way to share images on facebook like the official android gallery does. ¿How can it be achieved?

PD: i need to do it without facebook SDK, android gallery doesn't use facebook sdk.

NullPointerException
  • 36,107
  • 79
  • 222
  • 382

1 Answers1

0

Specify MIME type also for the text. "text/plain" is the type of text data MIME. Try using "/" as MIME, so you can send any generic data type.

Also try changing ACTION_SEND to ACTION_SEND_MULTIPLE which specialized for delivering multiple data.

More info about ACTION_SEND_MULTPLE and handling MIME types:

http://developer.android.com/reference/android/content/Intent.html

Hassaan Rabbani
  • 2,469
  • 5
  • 30
  • 55