Question

Please help me with my problem.My application has a button share that calls the Facebook Dialog Share class and I want to attached image when I click the share button.

But when following the Facebook.Sharedialog documentation, it has a method called addImageAttachment(String, File) to attach images but when using code below, I cannot access the addImageAttachment method.

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
                .setPicture("test.jpg") 
                .build();
        uiHelper.trackPendingDialogCall(shareDialog.present());

Or, maybe if theres a better way in sharing images in facebook just like in a game application with a share button and shared the screenshot of you app.

thanks guys.

Was it helpful?

Solution

in setPicture() you need to set a url for the image that you want to share.

FacebookDialog shareDialog = new FacebookDialog.ShareDialogBuilder(this)
            .setPicture("http://yourdomain.com/images/test.jpg") 
            .build();
    uiHelper.trackPendingDialogCall(shareDialog.present());

i see

try with this

 Bitmap bmp = R.drawable."bitmapFileName"; 

to take your bitmap from a drawable folder and...

protected Builder addImageAttachment(String imageName, Bitmap bitmap)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top