FacebookDialog.ShareDialogBuilder
最新版本的 SDK 已不再提供此課程。
有此級別的更新版本。前往查看 最新版本。

Provides a builder which can construct a FacebookDialog instance suitable for presenting the native Share dialog. This builder will throw an exception if the Facebook application is not installed, so it should only be used if FacebookDialog.canPresentShareDialog(android.content.Context, com.facebook.widget.FacebookDialog.ShareDialogFeature...) indicates the capability is available.

伸延:Object
套件:widget
建構函式
FacebookDialog.ShareDialogBuilderBase(Activity)

Constructor.

public FacebookDialog.ShareDialogBuilderBase(Activity activity)
參數說明
activityThe Activity which is presenting the native Share dialog; must not be null
FacebookDialog.ShareDialogBuilder(Activity)

Constructor.

public FacebookDialog.ShareDialogBuilder(Activity activity)
參數說明
activityThe Activity which is presenting the native Share dialog; must not be null
執行個體方法
setRequestCode(int)

Sets the request code that will be passed to handleActivityResult when this activity completes; the default is NativeProtocol.DIALOG_REQUEST_CODE.

public Builder setRequestCode(int requestCode)
參數說明
requestCodeThe request code
Returns
This instance of the builder
setApplicationName(String)

Sets the name of the application to be displayed in the dialog. If provided, this optimizes the user experience as a preview of a shared item, etc., can be displayed sooner.

public Builder setApplicationName(String applicationName)
參數說明
applicationNameThe name of the Facebook application
Returns
This instance of the builder
setFragment(Fragment)

Sets the fragment that should launch the dialog. This allows the dialog to be launched from a Fragment, and will allow the fragment to receive the onActivityResult.onActivityResult(int, int, android.content.Intent) call rather than the Activity.

public Builder setFragment(Fragment fragment)
參數說明
fragmentThe fragment that contains this control
build()

Constructs a FacebookDialog with an Intent that is correctly populated to present the dialog within the Facebook application.

public FacebookDialog build()
Returns
A FacebookDialog instance
canPresent()

Determines whether the native dialog can be presented (i.e., whether the required version of the Facebook application is installed on the device, and whether the installed version supports all of the parameters specified for the dialog).

public boolean canPresent()
Returns
True if the dialog can be presented; false if not
setName(String)

Sets the title of the item to be shared.

public ShareDialogBuilderBase setName(String name)
參數說明
nameThe title
Returns
This instance of the builder
setCaption(String)

Sets the subtitle of the item to be shared.

public ShareDialogBuilderBase setCaption(String caption)
參數說明
captionThe subtitle
Returns
This instance of the builder
setDescription(String)

Sets the description of the item to be shared.

public ShareDialogBuilderBase setDescription(String description)
參數說明
descriptionThe description
Returns
This instance of the builder
setPicture(String)

Sets the URL of the image of the item to be shared.

public ShareDialogBuilderBase setPicture(String picture)
參數說明
pictureThe URL of the image
Returns
This instance of the builder
setPlace(String)

Sets the place for the item to be shared.

public ShareDialogBuilderBase setPlace(String place)
參數說明
placeThe Facebook ID of the place
Returns
This instance of the builder
setFriends(List)

Sets the tagged friends for the item to be shared.

public ShareDialogBuilderBase setFriends(List friends)
參數說明
friendsA list of Facebook IDs of the friends to be tagged in the shared item
Returns
This instance of the builder
setRef(String)

Sets the 'ref' property of the item to be shared.

public ShareDialogBuilderBase setRef(String ref)
參數說明
refThe 'ref' property
Returns
This instance of the builder
setDataErrorsFatal(boolean)

Sets whether errors encountered during previewing the shared item should be considered fatal and cause the dialog to return an error

public ShareDialogBuilderBase setDataErrorsFatal(boolean dataErrorsFatal)
參數說明
dataErrorsFatalTrue if data errors should be fatal; false if not
Returns
This instance of the builder
常數
activity
protected final Activity activity
applicationId
protected final String applicationId
appCall
protected final PendingCall appCall