android - How to post the Image and Text in Facebook using Share Intent -


I am using the intent to share the image and text in the social media app. I am using the following code

  string shareName = advdetails.get (0) .getBusinessname (); String description = advdetails.get (0) .getDescription (); Uri image = Uri.parse (advdetails.get (0) .getBusinesslogo ()); Intuit shareIntent = new intent (android.content.Intent.ACTION_SEND); ShareIntent.setType ("image / *"); ShareIntent.putExtra (Intent.EXTRA_TEXT, details); ShareIntent.putExtra (Intent.EXTRA_STREAM, Image); Initial Activity (Intent.createChooser (shareIntent, shareName));  

The above description, image and share name are being from the pojo category

When I try to share these statistics in Facebook I am getting a notification because "one or more media items can not be added"

Try this to share the image

  file filePath = getFileStreamPath ("shareimage.jpg"); Intent shareIntent = new intent (); ShareIntent.setAction (Intent.ACTION_SEND); ShareIntent.putExtra (Intent.EXTRA_TEXT, _text); ShareIntent.putExtra (Intent.EXTRA_STREAM, Uri.fromFile (new file (file path)); // Optional // Use it when you want to send an image shareIntent.setType ("image / jpeg"); ShareIntent.addFlags (Intent.FLAG_GRANT_READ_URI_PERMISSION); Initialization (intestate charger (share intent, "send"));  

Comments