Android SDK Version
All Implemented Interfaces:
com.facebook.FacebookDialog , com.facebook.share.Sharer


public class ShareDialog
extends FacebookDialogBase<ShareContent<?, ?>, Sharer.Result> implements Sharer
Provides functionality to share content via the Facebook Share Dialog
Nested Class Summary
Modifier and TypeClassDescription
public enumShareDialog.Mode
The mode for the share dialog.
public classShareDialog.Companion
Field Summary
Modifier and TypeFieldDescription
private IntegerrequestCode
Constructor Summary
ConstructorDescription
ShareDialog(Activity activity)Constructs a new ShareDialog.
ShareDialog(Integer requestCode)Constructs a new ShareDialog without any context.
ShareDialog(Fragment fragment)Constructs a new ShareDialog.
ShareDialog(Fragment fragment)Constructs a new ShareDialog.
ShareDialog(Activity activity, Integer requestCode)for internal use only
ShareDialog(Fragment fragment, Integer requestCode)for internal use only
ShareDialog(Fragment fragment, Integer requestCode)for internal use only
ShareDialog(FragmentWrapper fragmentWrapper, Integer requestCode)for internal use only
Method Summary
Modifier and TypeMethodDescription
final IntegergetRequestCode()
final UnitsetRequestCode(Integer requestCode) Set the request code for the startActivityForResult call.
BooleangetShouldFailOnDataError() Specifies whether the sharer should fail if it finds an error with the share content.
UnitsetShouldFailOnDataError(Boolean shouldFailOnDataError) Specifies whether the sharer should fail if it finds an error with the share content.
BooleancanShow(ShareContent<?, ?> content, ShareDialog.Mode mode) Call this to check if the Share Dialog can be shown in a specific mode.
Unitshow(ShareContent<?, ?> content, ShareDialog.Mode mode) Call this to show the Share Dialog in a specific mode
Methods inherited from class com.facebook.share.widget.ShareDialog
canShow, createActivityResultContractForShowingDialog, registerCallback, registerCallback, setCallbackManager, show
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

ShareDialog

ShareDialog(Activity activity)
Constructs a new ShareDialog.
Parameters:
activity - Activity to use to share the provided content.

ShareDialog

ShareDialog(Integer requestCode)
Constructs a new ShareDialog without any context.

ShareDialog

ShareDialog(Fragment fragment)
Constructs a new ShareDialog.
Parameters:
fragment - androidx.fragment.app.Fragment to use to share the provided content.

ShareDialog

ShareDialog(Fragment fragment)
Constructs a new ShareDialog.
Parameters:
fragment - android.app.Fragment to use to share the provided content.

ShareDialog

ShareDialog(Activity activity, Integer requestCode)
for internal use only

ShareDialog

ShareDialog(Fragment fragment, Integer requestCode)
for internal use only

ShareDialog

ShareDialog(Fragment fragment, Integer requestCode)
for internal use only

ShareDialog

ShareDialog(FragmentWrapper fragmentWrapper, Integer requestCode)
for internal use only
Method Detail

getRequestCode

 final IntegergetRequestCode()

setRequestCode

 final UnitsetRequestCode(Integer requestCode)
Set the request code for the startActivityForResult call. The requestCode should be outside of the range of those reserved for the Facebook SDK .
Parameters:
requestCode - the request code to use.

getShouldFailOnDataError

BooleangetShouldFailOnDataError()
Specifies whether the sharer should fail if it finds an error with the share content. If false, the share dialog will still be displayed without the data that was mis-configured. For example, an invalid placeID specified on the shareContent would produce a data error.

setShouldFailOnDataError

UnitsetShouldFailOnDataError(Boolean shouldFailOnDataError)
Specifies whether the sharer should fail if it finds an error with the share content. If false, the share dialog will still be displayed without the data that was mis-configured. For example, an invalid placeID specified on the shareContent would produce a data error.
Parameters:
shouldFailOnDataError - whether the dialog should fail if it finds an error.

canShow

BooleancanShow(ShareContent<?, ?> content, ShareDialog.Mode mode)
Call this to check if the Share Dialog can be shown in a specific mode.
Parameters:
mode - Mode of the Share Dialog

show

Unitshow(ShareContent<?, ?> content, ShareDialog.Mode mode)
Call this to show the Share Dialog in a specific mode
Parameters:
mode - Mode of the Share Dialog