-1
Intent i = new Intent(Intent.ACTION_SEND);
i.setType("image/jpeg");
Uri uri = Uri.parse("android.resource://my package name/"+value(passing value of image));
i.putExtra(Intent.EXTRA_STREAM, uri);
PackageInfo info=pm.getPackageInfo("com.facebook.katana", PackageManager.GET_META_DATA);
i.setPackage("com.facebook.katana");
startActivity(Intent.createChooser(i, "Share with"));

Facebook opens but without the image, it's empty.

IKavanagh
  • 6,089
  • 11
  • 42
  • 47
Uday Patel
  • 11
  • 1
  • Few apps will expect an `android.resource` `Uri` and therefore may not handle it correctly. A `content://` `Uri`, or perhaps a `file://` `Uri`, are likely to work better here. – CommonsWare Oct 29 '15 at 11:21

1 Answers1

-1

Hope below code will help you.

The Facebook app sharing work is to share only a link with no text:

     Intent shareIntent = new Intent();
     shareIntent.setAction(Intent.ACTION_SEND);
     shareIntent.putExtra(Intent.EXTRA_TEXT, _text);
     shareIntent.putExtra(Intent.EXTRA_STREAM,Uri.Uri.parse(filePath));  
     shareIntent.setType("image/jpeg");
     shareIntent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);

    intent.putExtra(Intent.EXTRA_TEXT, "http://www.google.com/");
    startActivity(Intent.createChooser(shareIntent, "Share with"));

OR for reference you can refer this link.

Community
  • 1
  • 1
KishuDroid
  • 5,411
  • 4
  • 30
  • 47
  • Please explain how this answers the question. The OP is trying to share an image from a resource via `EXTRA_STREAM`. – CommonsWare Oct 29 '15 at 11:21