문제

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.

도움이 되었습니까?

해결책

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)
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top