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

Provides a builder which can construct a FacebookDialog instance suitable for presenting the native Open Graph action publish dialog. This builder allows the caller to specify binary images for both the action and any Open Graph objects to be created prior to publishing the action. This builder will throw an exception if the Facebook application is not installed, so it should only be used if FacebookDialog.canPresentOpenGraphActionDialog(android.content.Context, com.facebook.widget.FacebookDialog.OpenGraphActionDialogFeature...) indicates the capability is available.

延伸:Object
套件:widget
建構函式
FacebookDialog.OpenGraphDialogBuilderBase(Activity, OpenGraphAction, String, String)

Constructor.

public FacebookDialog.OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, String actionType, String previewPropertyName)
參數說明
activityThe Activity which is presenting the native Open Graph action publish dialog; must not be null
actionThe Open Graph action to be published, which must contain a reference to at least one Open Graph object with the property name specified by setPreviewPropertyName; the action must have had its type specified via the OpenGraphAction.setType(String) method
actionTypeThe type of the Open Graph action to be published, which should be the namespace-qualified name of the action type (e.g., "myappnamespace:myactiontype"); this will override the type of the action passed in.
previewPropertyNameThe name of a property on the Open Graph action that contains the Open Graph object which will be displayed as a preview to the user
FacebookDialog.OpenGraphDialogBuilderBase(Activity, OpenGraphAction, String)

Constructor.

public FacebookDialog.OpenGraphDialogBuilderBase(Activity activity, OpenGraphAction action, String previewPropertyName)
參數說明
activityThe Activity which is presenting the native Open Graph action publish dialog; must not be null
actionThe Open Graph action to be published, which must contain a reference to at least one Open Graph object with the property name specified by setPreviewPropertyName; the action must have had its type specified via the OpenGraphAction.setType(String) method
previewPropertyNameThe name of a property on the Open Graph action that contains the Open Graph object which will be displayed as a preview to the user
FacebookDialog.OpenGraphActionDialogBuilder(Activity, OpenGraphAction, String, String)

Constructor.

public FacebookDialog.OpenGraphActionDialogBuilder(Activity activity, OpenGraphAction action, String actionType, String previewPropertyName)
參數說明
activityThe Activity which is presenting the native Open Graph action publish dialog; must not be null
actionThe Open Graph action to be published, which must contain a reference to at least one Open Graph object with the property name specified by setPreviewPropertyName; the action must have had its type specified via the OpenGraphAction.setType(String) method
actionTypeThe type of the Open Graph action to be published, which should be the namespace-qualified name of the action type (e.g., "myappnamespace:myactiontype"); this will override the type of the action passed in.
previewPropertyNameThe name of a property on the Open Graph action that contains the Open Graph object which will be displayed as a preview to the user
FacebookDialog.OpenGraphActionDialogBuilder(Activity, OpenGraphAction, String)

Constructor.

public FacebookDialog.OpenGraphActionDialogBuilder(Activity activity, OpenGraphAction action, String previewPropertyName)
參數說明
activityThe Activity which is presenting the native Open Graph action publish dialog; must not be null
actionThe Open Graph action to be published, which must contain a reference to at least one Open Graph object with the property name specified by setPreviewPropertyName; the action must have had its type specified via the OpenGraphAction.setType(String) method
previewPropertyNameThe name of a property on the Open Graph action that contains the Open Graph object which will be displayed as a preview to the user
執行個體方法
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
addImageAttachments(Collection)
protected List addImageAttachments(Collection bitmaps)
參數說明
bitmaps
addImageAttachmentFiles(Collection)
protected List addImageAttachmentFiles(Collection bitmapFiles)
參數說明
bitmapFiles
addImageAttachment(String, Bitmap)
protected Builder addImageAttachment(String imageName, Bitmap bitmap)
參數說明
imageName
bitmap
addImageAttachment(String, File)
protected Builder addImageAttachment(String imageName, File attachment)
參數說明
imageName
attachment
setDataErrorsFatal(boolean)

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

public OpenGraphDialogBuilderBase setDataErrorsFatal(boolean dataErrorsFatal)
參數說明
dataErrorsFatalTrue if data errors should be fatal; false if not
Returns
This instance of the builder
setImageAttachmentsForAction(List)

Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the action. The action must already have been set prior to calling this method. This method will generate unique names for the image attachments and update the action to refer to these attachments. Note that calling setAction again after calling this method will not clear the image attachments already set, but the new action will have no reference to the existing attachments. The images will not be marked as being user-generated.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentsForAction(List bitmaps)
參數說明
bitmapsA list of Bitmaps to be uploaded and attached to the Open Graph action
Returns
This instance of the builder
setImageAttachmentsForAction(List, boolean)

Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the action. The action must already have been set prior to calling this method. This method will generate unique names for the image attachments and update the action to refer to these attachments. Note that calling setAction again after calling this method will not clear the image attachments already set, but the new action will have no reference to the existing attachments. The images may be marked as being user-generated -- refer to this article for more information.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentsForAction(List bitmaps, boolean isUserGenerated)
參數說明
bitmapsA list of Bitmaps to be uploaded and attached to the Open Graph action
isUserGeneratedIf true, specifies that the user_generated flag should be set for these images
Returns
This instance of the builder
setImageAttachmentFilesForAction(List)

Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the action. The action must already have been set prior to calling this method. The images will not be marked as being user-generated. This method will generate unique names for the image attachments and update the action to refer to these attachments. Note that calling setAction again after calling this method will not clear the image attachments already set, but the new action will have no reference to the existing attachments.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentFilesForAction(List bitmapFiles)
參數說明
bitmapFilesA list of Files containing bitmaps to be uploaded and attached to the Open Graph action
Returns
This instance of the builder
setImageAttachmentFilesForAction(List, boolean)

Specifies a list of images for the Open Graph action that should be uploaded prior to publishing the action. The action must already have been set prior to calling this method. The images may be marked as being user-generated -- refer to this article for more information. This method will generate unique names for the image attachments and update the action to refer to these attachments. Note that calling setAction again after calling this method will not clear the image attachments already set, but the new action will have no reference to the existing attachments.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentFilesForAction(List bitmapFiles, boolean isUserGenerated)
參數說明
bitmapFilesA list of Files containing bitmaps to be uploaded and attached to the Open Graph action
isUserGeneratedIf true, specifies that the user_generated flag should be set for these images
Returns
This instance of the builder
setImageAttachmentsForObject(String, List)

Specifies a list of images for an Open Graph object referenced by the action that should be uploaded prior to publishing the action. The images will not be marked as user-generated. The action must already have been set prior to calling this method, and the action must have a GraphObject-valued property with the specified property name. This method will generate unique names for the image attachments and update the graph object to refer to these attachments. Note that calling setObject again after calling this method, or modifying the value of the specified property, will not clear the image attachments already set, but the new action (or objects) will have no reference to the existing attachments.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentsForObject(String objectProperty, List bitmaps)
參數說明
objectPropertyThe name of a property on the action that corresponds to an Open Graph object; the object must be marked as a new object to be created (i.e., OpenGraphObject.getCreateObject() must return true) or an exception will be thrown
bitmapsA list of Files containing bitmaps to be uploaded and attached to the Open Graph object
Returns
This instance of the builder
setImageAttachmentsForObject(String, List, boolean)

Specifies a list of images for an Open Graph object referenced by the action that should be uploaded prior to publishing the action. The images may be marked as being user-generated -- refer to this article for more information. The action must already have been set prior to calling this method, and the action must have a GraphObject-valued property with the specified property name. This method will generate unique names for the image attachments and update the graph object to refer to these attachments. Note that calling setObject again after calling this method, or modifying the value of the specified property, will not clear the image attachments already set, but the new action (or objects) will have no reference to the existing attachments.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentsForObject(String objectProperty, List bitmaps, boolean isUserGenerated)
參數說明
objectPropertyThe name of a property on the action that corresponds to an Open Graph object
bitmapsA list of Files containing bitmaps to be uploaded and attached to the Open Graph object
isUserGeneratedIf true, specifies that the user_generated flag should be set for these images
Returns
This instance of the builder
setImageAttachmentFilesForObject(String, List)

Specifies a list of images for an Open Graph object referenced by the action that should be uploaded prior to publishing the action. The images will not be marked as user-generated. The action must already have been set prior to calling this method, and the action must have a GraphObject-valued property with the specified property name. This method will generate unique names for the image attachments and update the graph object to refer to these attachments. Note that calling setObject again after calling this method, or modifying the value of the specified property, will not clear the image attachments already set, but the new action (or objects) will have no reference to the existing attachments.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentFilesForObject(String objectProperty, List bitmapFiles)
參數說明
objectPropertyThe name of a property on the action that corresponds to an Open Graph object; the object must be marked as a new object to be created (i.e., OpenGraphObject.getCreateObject() must return true) or an exception will be thrown
bitmapFilesA list of Bitmaps to be uploaded and attached to the Open Graph object
Returns
This instance of the builder
setImageAttachmentFilesForObject(String, List, boolean)

Specifies a list of images for an Open Graph object referenced by the action that should be uploaded prior to publishing the action. The images may be marked as being user-generated -- refer to this article for more information. The action must already have been set prior to calling this method, and the action must have a GraphObject-valued property with the specified property name. This method will generate unique names for the image attachments and update the graph object to refer to these attachments. Note that calling setObject again after calling this method, or modifying the value of the specified property, will not clear the image attachments already set, but the new action (or objects) will have no reference to the existing attachments.

In order for the images to be provided to the Facebook application as part of the app call, the NativeAppCallContentProvider must be specified correctly in the application's AndroidManifest.xml.

public OpenGraphDialogBuilderBase setImageAttachmentFilesForObject(String objectProperty, List bitmapFiles, boolean isUserGenerated)
參數說明
objectPropertyThe name of a property on the action that corresponds to an Open Graph object; the object must be marked as a new object to be created (i.e., OpenGraphObject.getCreateObject() must return true) or an exception will be thrown
bitmapFilesA list of Bitmaps to be uploaded and attached to the Open Graph object
isUserGeneratedIf true, specifies that the user_generated flag should be set for these images
Returns
This instance of the builder
常數
activity
protected final Activity activity
applicationId
protected final String applicationId
appCall
protected final PendingCall appCall