2016-12-29 61 views
1

我正在開發一個Android應用程序,讓用戶可以將照片分享到Facebook,所以我使用FacebookDialog作爲我的應用程序。 我跟着Facebook developer guide,我試着爲共享設置Hashtag,但是FacebookDialog沒有Hashtag彈出。 代碼設置分享標籤爲對話

image = MediaStore.Images.Media.getBitmap(getContext().getContentResolver(), descriptionPhotoUri); 
SharePhoto photo = new SharePhoto.Builder() 
    .setBitmap(image) 
    .build(); 
SharePhotoContent content = new SharePhotoContent.Builder() 
    .setShareHashtag(new ShareHashtag.Builder().setHashtag(Constants.APPLICATION_HASHTAG).build()) 
    .addPhoto(photo) 
    .build(); 
facebookShareDialog.show(content, ShareDialog.Mode.AUTOMATIC); 

構建等級:

compile 'com.facebook.android:facebook-android-sdk:4.+' 

enter image description here 有什麼辦法來設置主題標記使用facebookdialog共享內容。

你有什麼建議嗎?

+0

Constants.APPLICATION_HASHTAG就像「#Aiuspaktyn」? – Aiuspaktyn

+0

你有沒有解決這個問題? –

+0

不,我沒有.. –

回答

0

你應該嘗試:

SharePhoto photo = new SharePhoto.Builder() 
        .setBitmap(image) 
        .build(); 

ShareContent shareContent = new ShareMediaContent.Builder() 
        .addMedium(photo) 
        .setShareHashtag(new ShareHashtag.Builder() 
          .setHashtag("#Whatever") 
          .build()) 
        .build(); 

它的工作對我來說,不同的是,你使用new SharePhotoContent.Builder()代替new ShareMediaContent.Builder()

希望它有幫助。