Android SDK Version
Direct Known Subclasses:

public abstract class ShareButtonBase
extends FacebookButtonBase
A base class for sharing buttons.
Constructor Summary
ModifierConstructor and Description
protected ShareButtonBase(Context context, AttributeSet attrs, int defStyleAttr, java.lang.String analyticsButtonCreatedEventName, java.lang.String analyticsButtonTappedEventName) 
Method Summary
Modifier and TypeMethod and Description
protected booleancanShare() 
protected voidconfigureButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) 
protected abstract com.facebook.internal.FacebookDialogBase<ShareContent,Sharer.Result>getDialog() 
intgetRequestCode()
Returns the request code used for this Button.
ShareContentgetShareContent()
Returns the share content from the button.
protected OnClickListenergetShareOnClickListener() 
voidregisterCallback(CallbackManager callbackManager, FacebookCallback<Sharer.Result> callback)
Allows registration of a callback for when the share completes.
voidregisterCallback(CallbackManager callbackManager, FacebookCallback<Sharer.Result> callback, int requestCode)
Allows registration of a callback for when the share completes.
voidsetEnabled(boolean enabled) 
protected voidsetRequestCode(int requestCode)
Set the request code for the startActivityForResult call.
voidsetShareContent(ShareContent shareContent)
Sets the share content on the button.
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail

ShareButtonBase

protected ShareButtonBase(Context context,
                          AttributeSet attrs,
                          int defStyleAttr,
                          java.lang.String analyticsButtonCreatedEventName,
                          java.lang.String analyticsButtonTappedEventName)
Method Detail

getShareContent

public ShareContent getShareContent()
Returns the share content from the button.
Returns:
The share content.

setShareContent

public void setShareContent(ShareContent shareContent)
Sets the share content on the button.
Parameters:
shareContent - The share content.

setEnabled

public void setEnabled(boolean enabled)

getRequestCode

public int getRequestCode()
Returns the request code used for this Button.
Overrides:
Returns:
the request code.

setRequestCode

protected void setRequestCode(int requestCode)
Set the request code for the startActivityForResult call. The requestCode should be outside of the range of those reserved for the Facebook SDK FacebookSdk.isFacebookRequestCode(int). This method should also be called prior to registering any callbacks.
Parameters:
requestCode - the request code to use.

registerCallback

public void registerCallback(CallbackManager callbackManager,
                             FacebookCallback<Sharer.Result> callback)
Allows registration of a callback for when the share completes. This should be called in the android.app.Activity#onCreate(android.os.Bundle) or android.support.v4.app.Fragment#onCreate(android.os.Bundle) methods.
Parameters:
callbackManager - The CallbackManager instance that will be handling results that are received via android.app.Activity#onActivityResult(int, int, android.content.Intent)
callback - The callback that should be called to handle dialog completion.

registerCallback

public void registerCallback(CallbackManager callbackManager,
                             FacebookCallback<Sharer.Result> callback,
                             int requestCode)
Allows registration of a callback for when the share completes. This should be called in the android.app.Activity#onCreate(android.os.Bundle) or android.support.v4.app.Fragment#onCreate(android.os.Bundle) methods.
Parameters:
callbackManager - The CallbackManager instance that will be handling results that are received via android.app.Activity#onActivityResult(int, int, android.content.Intent)
callback - The callback that should be called to handle dialog completion.
requestCode - The request code to use, this should be outside of the range of those reserved for the Facebook SDK FacebookSdk.isFacebookRequestCode(int).

configureButton

protected void configureButton(Context context,
                               AttributeSet attrs,
                               int defStyleAttr,
                               int defStyleRes)
Overrides:

canShare

protected boolean canShare()

getShareOnClickListener

protected OnClickListener getShareOnClickListener()

getDialog

protected abstract com.facebook.internal.FacebookDialogBase<ShareContent,Sharer.Result> getDialog()