Android SDK Version

public final class DeviceShareButton
extends FacebookButtonBase
A button to share content on Facebook from a device. Tapping the receiver will invoke the DeviceShareDialog with the attached shareContent.
Constructor Summary
Constructor and Description
DeviceShareButton(Context context) 
DeviceShareButton(Context context, AttributeSet attrs) 
Method Summary
Modifier and TypeMethod and Description
protected voidconfigureButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) 
protected intgetDefaultRequestCode() 
protected intgetDefaultStyleResource() 
intgetRequestCode()
Returns the request code used for this Button.
ShareContentgetShareContent()
Returns the share content from the button.
protected OnClickListenergetShareOnClickListener() 
voidregisterCallback(CallbackManager callbackManager, FacebookCallback<DeviceShareDialog.Result> callback)
Allows registration of a callback for when the share completes.
voidregisterCallback(CallbackManager callbackManager, FacebookCallback<DeviceShareDialog.Result> callback, int requestCode)
Allows registration of a callback for when the share completes.
voidsetEnabled(boolean enabled) 
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

DeviceShareButton

public DeviceShareButton(Context context)

DeviceShareButton

public DeviceShareButton(Context context,
                         AttributeSet attrs)
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()
Description copied from class: FacebookButtonBase
Returns the request code used for this Button.
Overrides:
Returns:
the request code.

registerCallback

public void registerCallback(CallbackManager callbackManager,
                             FacebookCallback<DeviceShareDialog.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<DeviceShareDialog.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:

getDefaultStyleResource

protected int getDefaultStyleResource()

getDefaultRequestCode

protected int getDefaultRequestCode()

getShareOnClickListener

protected OnClickListener getShareOnClickListener()