com.facebook.widget
Class LoginButton

java.lang.Object
  extended by android.view.View
      extended by android.widget.TextView
          extended by android.widget.Button
              extended by com.facebook.widget.LoginButton
All Implemented Interfaces:
Drawable.Callback, AccessibilityEventSource, KeyEvent.Callback, ViewTreeObserver.OnPreDrawListener

public class LoginButton
extends Button

A Log In/Log Out button that maintains session state and logs in/out for the app.

This control will create and use the active session upon construction if it has the available data (if the app ID is specified in the manifest). It will also open the active session if it does not require user interaction (i.e. if the session is in the SessionState.CREATED_TOKEN_LOADED state. Developers can override the use of the active session by calling the setSession(com.facebook.Session) method.


Nested Class Summary
static interface LoginButton.OnErrorListener
          Callback interface that will be called when a network or other error is encountered while logging in.
static interface LoginButton.UserInfoChangedCallback
          Specifies a callback interface that will be called when the button's notion of the current user changes (if the fetch_user_info attribute is true for this control).
 
Nested classes/interfaces inherited from class android.widget.TextView
TextView.BufferType, TextView.OnEditorActionListener, TextView.SavedState
 
Nested classes/interfaces inherited from class android.view.View
View.AccessibilityDelegate, View.BaseSavedState, View.DragShadowBuilder, View.MeasureSpec, View.OnAttachStateChangeListener, View.OnClickListener, View.OnCreateContextMenuListener, View.OnDragListener, View.OnFocusChangeListener, View.OnGenericMotionListener, View.OnHoverListener, View.OnKeyListener, View.OnLayoutChangeListener, View.OnLongClickListener, View.OnSystemUiVisibilityChangeListener, View.OnTouchListener
 
Field Summary
 
Fields inherited from class android.view.View
ALPHA, DRAWING_CACHE_QUALITY_AUTO, DRAWING_CACHE_QUALITY_HIGH, DRAWING_CACHE_QUALITY_LOW, EMPTY_STATE_SET, ENABLED_FOCUSED_SELECTED_STATE_SET, ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_FOCUSED_STATE_SET, ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, ENABLED_SELECTED_STATE_SET, ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, ENABLED_STATE_SET, ENABLED_WINDOW_FOCUSED_STATE_SET, FIND_VIEWS_WITH_CONTENT_DESCRIPTION, FIND_VIEWS_WITH_TEXT, FOCUS_BACKWARD, FOCUS_DOWN, FOCUS_FORWARD, FOCUS_LEFT, FOCUS_RIGHT, FOCUS_UP, FOCUSABLES_ALL, FOCUSABLES_TOUCH_MODE, FOCUSED_SELECTED_STATE_SET, FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, FOCUSED_STATE_SET, FOCUSED_WINDOW_FOCUSED_STATE_SET, GONE, HAPTIC_FEEDBACK_ENABLED, IMPORTANT_FOR_ACCESSIBILITY_AUTO, IMPORTANT_FOR_ACCESSIBILITY_NO, IMPORTANT_FOR_ACCESSIBILITY_YES, INVISIBLE, KEEP_SCREEN_ON, LAYER_TYPE_HARDWARE, LAYER_TYPE_NONE, LAYER_TYPE_SOFTWARE, MEASURED_HEIGHT_STATE_SHIFT, MEASURED_SIZE_MASK, MEASURED_STATE_MASK, MEASURED_STATE_TOO_SMALL, NO_ID, OVER_SCROLL_ALWAYS, OVER_SCROLL_IF_CONTENT_SCROLLS, OVER_SCROLL_NEVER, PRESSED_ENABLED_FOCUSED_SELECTED_STATE_SET, PRESSED_ENABLED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_STATE_SET, PRESSED_ENABLED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_SELECTED_STATE_SET, PRESSED_ENABLED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_ENABLED_STATE_SET, PRESSED_ENABLED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_SELECTED_STATE_SET, PRESSED_FOCUSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_FOCUSED_STATE_SET, PRESSED_FOCUSED_WINDOW_FOCUSED_STATE_SET, PRESSED_SELECTED_STATE_SET, PRESSED_SELECTED_WINDOW_FOCUSED_STATE_SET, PRESSED_WINDOW_FOCUSED_STATE_SET, ROTATION, ROTATION_X, ROTATION_Y, SCALE_X, SCALE_Y, SCREEN_STATE_OFF, SCREEN_STATE_ON, SCROLLBAR_POSITION_DEFAULT, SCROLLBAR_POSITION_LEFT, SCROLLBAR_POSITION_RIGHT, SCROLLBARS_INSIDE_INSET, SCROLLBARS_INSIDE_OVERLAY, SCROLLBARS_OUTSIDE_INSET, SCROLLBARS_OUTSIDE_OVERLAY, SELECTED_STATE_SET, SELECTED_WINDOW_FOCUSED_STATE_SET, SOUND_EFFECTS_ENABLED, STATUS_BAR_HIDDEN, STATUS_BAR_VISIBLE, SYSTEM_UI_FLAG_FULLSCREEN, SYSTEM_UI_FLAG_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN, SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION, SYSTEM_UI_FLAG_LAYOUT_STABLE, SYSTEM_UI_FLAG_LOW_PROFILE, SYSTEM_UI_FLAG_VISIBLE, SYSTEM_UI_LAYOUT_FLAGS, TEXT_ALIGNMENT_INHERIT, TEXT_ALIGNMENT_RESOLVED_DEFAULT, TRANSLATION_X, TRANSLATION_Y, VIEW_LOG_TAG, VISIBLE, WINDOW_FOCUSED_STATE_SET, X, Y
 
Constructor Summary
LoginButton(Context context)
          Create the LoginButton.
LoginButton(Context context, AttributeSet attrs)
          Create the LoginButton by inflating from XML
LoginButton(Context context, AttributeSet attrs, int defStyle)
          Create the LoginButton by inflating from XML and applying a style.
 
Method Summary
 void clearPermissions()
          Clears the permissions currently associated with this LoginButton.
 SessionDefaultAudience getDefaultAudience()
          Gets the default audience to use when the session is opened.
 SessionLoginBehavior getLoginBehavior()
          Gets the login behavior for the session that will be opened.
 LoginButton.OnErrorListener getOnErrorListener()
          Returns the current OnErrorListener for this instance of LoginButton.
 Session.StatusCallback getSessionStatusCallback()
          Sets the callback interface that will be called whenever the status of the Session associated with this LoginButton changes.
 LoginButton.UserInfoChangedCallback getUserInfoChangedCallback()
          Gets the callback interface that will be called when the current user changes.
 boolean onActivityResult(int requestCode, int resultCode, Intent data)
          Provides an implementation for onActivityResult that updates the Session based on information returned during the authorization flow.
protected  void onAttachedToWindow()
           
protected  void onDetachedFromWindow()
           
 void onFinishInflate()
           
 void setApplicationId(String applicationId)
          Set the application ID to be used to open the session.
 void setDefaultAudience(SessionDefaultAudience defaultAudience)
          Sets the default audience to use when the session is opened.
 void setFragment(Fragment fragment)
          Sets the fragment that contains this control.
 void setLoginBehavior(SessionLoginBehavior loginBehavior)
          Sets the login behavior for the session that will be opened.
 void setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
          Sets an OnErrorListener for this instance of LoginButton to call into when certain exceptions occur.
 void setPublishPermissions(List<String> permissions)
          Set the permissions to use when the session is opened.
 void setReadPermissions(List<String> permissions)
          Set the permissions to use when the session is opened.
 void setSession(Session newSession)
          Set the Session object to use instead of the active Session.
 void setSessionStatusCallback(Session.StatusCallback callback)
          Sets the callback interface that will be called whenever the status of the Session associated with this LoginButton changes.
 void setUserInfoChangedCallback(LoginButton.UserInfoChangedCallback userInfoChangedCallback)
          Sets the callback interface that will be called when the current user changes.
 
Methods inherited from class android.widget.Button
onInitializeAccessibilityEvent, onInitializeAccessibilityNodeInfo
 
Methods inherited from class android.widget.TextView
addTextChangedListener, append, append, beginBatchEdit, bringPointIntoView, cancelLongPress, clearComposingText, computeHorizontalScrollRange, computeScroll, computeVerticalScrollExtent, computeVerticalScrollRange, debug, didTouchFocusSelect, drawableStateChanged, endBatchEdit, extractText, findViewsWithText, getAutoLinkMask, getBaseline, getBottomPaddingOffset, getCompoundDrawablePadding, getCompoundDrawables, getCompoundPaddingBottom, getCompoundPaddingLeft, getCompoundPaddingRight, getCompoundPaddingTop, getCurrentHintTextColor, getCurrentTextColor, getCustomSelectionActionModeCallback, getDefaultEditable, getDefaultMovementMethod, getEditableText, getEllipsize, getError, getExtendedPaddingBottom, getExtendedPaddingTop, getFilters, getFocusedRect, getFreezesText, getGravity, getHighlightColor, getHint, getHintTextColors, getImeActionId, getImeActionLabel, getImeOptions, getIncludeFontPadding, getInputExtras, getInputType, getKeyListener, getLayout, getLeftFadingEdgeStrength, getLeftPaddingOffset, getLineBounds, getLineCount, getLineHeight, getLineSpacingExtra, getLineSpacingMultiplier, getLinksClickable, getLinkTextColors, getMarqueeRepeatLimit, getMaxEms, getMaxHeight, getMaxLines, getMaxWidth, getMinEms, getMinHeight, getMinLines, getMinWidth, getMovementMethod, getOffsetForPosition, getPaint, getPaintFlags, getPrivateImeOptions, getRightFadingEdgeStrength, getRightPaddingOffset, getSelectionEnd, getSelectionStart, getShadowColor, getShadowDx, getShadowDy, getShadowRadius, getText, getTextColor, getTextColors, getTextColors, getTextScaleX, getTextSize, getTopPaddingOffset, getTotalPaddingBottom, getTotalPaddingLeft, getTotalPaddingRight, getTotalPaddingTop, getTransformationMethod, getTypeface, getUrls, hasOverlappingRendering, hasSelection, invalidateDrawable, isCursorVisible, isInputMethodTarget, isPaddingOffsetRequired, isSuggestionsEnabled, isTextSelectable, jumpDrawablesToCurrentState, length, moveCursorToVisibleOffset, onBeginBatchEdit, onCheckIsTextEditor, onCommitCompletion, onCommitCorrection, onCreateDrawableState, onCreateInputConnection, onDragEvent, onDraw, onEditorAction, onEndBatchEdit, onFinishTemporaryDetach, onFocusChanged, onGenericMotionEvent, onKeyDown, onKeyMultiple, onKeyPreIme, onKeyShortcut, onKeyUp, onLayout, onMeasure, onPopulateAccessibilityEvent, onPreDraw, onPrivateIMECommand, onRestoreInstanceState, onSaveInstanceState, onScreenStateChanged, onScrollChanged, onSelectionChanged, onStartTemporaryDetach, onTextChanged, onTextContextMenuItem, onTouchEvent, onTrackballEvent, onVisibilityChanged, onWindowFocusChanged, performLongClick, removeTextChangedListener, resetResolvedDrawables, resolveDrawables, sendAccessibilityEvent, setAllCaps, setAutoLinkMask, setCompoundDrawablePadding, setCompoundDrawables, setCompoundDrawablesWithIntrinsicBounds, setCompoundDrawablesWithIntrinsicBounds, setCursorVisible, setCustomSelectionActionModeCallback, setEditableFactory, setEllipsize, setEms, setEnabled, setError, setError, setExtractedText, setFilters, setFrame, setFreezesText, setGravity, setHeight, setHighlightColor, setHint, setHint, setHintTextColor, setHintTextColor, setHorizontallyScrolling, setImeActionLabel, setImeOptions, setIncludeFontPadding, setInputExtras, setInputType, setKeyListener, setLines, setLineSpacing, setLinksClickable, setLinkTextColor, setLinkTextColor, setMarqueeRepeatLimit, setMaxEms, setMaxHeight, setMaxLines, setMaxWidth, setMinEms, setMinHeight, setMinLines, setMinWidth, setMovementMethod, setOnEditorActionListener, setPadding, setPaddingRelative, setPaintFlags, setPrivateImeOptions, setRawInputType, setScroller, setSelectAllOnFocus, setSelected, setShadowLayer, setSingleLine, setSingleLine, setSpannableFactory, setText, setText, setText, setText, setText, setTextAppearance, setTextColor, setTextColor, setTextIsSelectable, setTextKeepState, setTextKeepState, setTextScaleX, setTextSize, setTextSize, setTransformationMethod, setTypeface, setTypeface, setWidth, verifyDrawable
 
Methods inherited from class android.view.View
addChildrenForAccessibility, addFocusables, addFocusables, addOnAttachStateChangeListener, addOnLayoutChangeListener, addTouchables, animate, announceForAccessibility, awakenScrollBars, awakenScrollBars, awakenScrollBars, bringToFront, buildDrawingCache, buildDrawingCache, buildLayer, callOnClick, canScrollHorizontally, canScrollVertically, checkInputConnectionProxy, clearAnimation, clearFocus, combineMeasuredStates, computeHorizontalScrollExtent, computeHorizontalScrollOffset, computeVerticalScrollOffset, createAccessibilityNodeInfo, createContextMenu, destroyDrawingCache, dispatchConfigurationChanged, dispatchDisplayHint, dispatchDragEvent, dispatchDraw, dispatchGenericFocusedEvent, dispatchGenericMotionEvent, dispatchGenericPointerEvent, dispatchHoverEvent, dispatchKeyEvent, dispatchKeyEventPreIme, dispatchKeyShortcutEvent, dispatchPopulateAccessibilityEvent, dispatchRestoreInstanceState, dispatchSaveInstanceState, dispatchSetActivated, dispatchSetPressed, dispatchSetSelected, dispatchSystemUiVisibilityChanged, dispatchTouchEvent, dispatchTrackballEvent, dispatchUnhandledMove, dispatchVisibilityChanged, dispatchWindowFocusChanged, dispatchWindowSystemUiVisiblityChanged, dispatchWindowVisibilityChanged, draw, findFocus, findViewById, findViewWithTag, fitSystemWindows, focusSearch, forceLayout, getAccessibilityNodeProvider, getAlpha, getAnimation, getApplicationWindowToken, getBackground, getBottom, getBottomFadingEdgeStrength, getCameraDistance, getContentDescription, getContext, getContextMenuInfo, getDefaultSize, getDrawableState, getDrawingCache, getDrawingCache, getDrawingCacheBackgroundColor, getDrawingCacheQuality, getDrawingRect, getDrawingTime, getFilterTouchesWhenObscured, getFitsSystemWindows, getFocusables, getGlobalVisibleRect, getGlobalVisibleRect, getHandler, getHeight, getHitRect, getHorizontalFadingEdgeLength, getHorizontalScrollbarHeight, getId, getImportantForAccessibility, getKeepScreenOn, getKeyDispatcherState, getLayerType, getLayoutParams, getLeft, getLocalVisibleRect, getLocationInWindow, getLocationOnScreen, getMatrix, getMeasuredHeight, getMeasuredHeightAndState, getMeasuredState, getMeasuredWidth, getMeasuredWidthAndState, getMinimumHeight, getMinimumWidth, getNextFocusDownId, getNextFocusForwardId, getNextFocusLeftId, getNextFocusRightId, getNextFocusUpId, getOnFocusChangeListener, getOverScrollMode, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getParentForAccessibility, getPivotX, getPivotY, getResources, getRight, getRootView, getRotation, getRotationX, getRotationY, getScaleX, getScaleY, getScrollBarDefaultDelayBeforeFade, getScrollBarFadeDuration, getScrollBarSize, getScrollBarStyle, getScrollX, getScrollY, getSolidColor, getSuggestedMinimumHeight, getSuggestedMinimumWidth, getSystemUiVisibility, getTag, getTag, getTop, getTopFadingEdgeStrength, getTouchables, getTouchDelegate, getTranslationX, getTranslationY, getVerticalFadingEdgeLength, getVerticalScrollbarPosition, getVerticalScrollbarWidth, getViewTreeObserver, getVisibility, getWidth, getWindowAttachCount, getWindowSystemUiVisibility, getWindowToken, getWindowVisibility, getWindowVisibleDisplayFrame, getX, getY, hasFocus, hasFocusable, hasOnClickListeners, hasTransientState, hasWindowFocus, inflate, initializeFadingEdge, initializeScrollbars, invalidate, invalidate, invalidate, isActivated, isClickable, isDirty, isDrawingCacheEnabled, isDuplicateParentStateEnabled, isEnabled, isFocusable, isFocusableInTouchMode, isFocused, isHapticFeedbackEnabled, isHardwareAccelerated, isHorizontalFadingEdgeEnabled, isHorizontalScrollBarEnabled, isHovered, isInEditMode, isInTouchMode, isLayoutRequested, isLongClickable, isOpaque, isPressed, isSaveEnabled, isSaveFromParentEnabled, isScrollbarFadingEnabled, isScrollContainer, isSelected, isShown, isSoundEffectsEnabled, isVerticalFadingEdgeEnabled, isVerticalScrollBarEnabled, layout, measure, mergeDrawableStates, offsetLeftAndRight, offsetTopAndBottom, onAnimationEnd, onAnimationStart, onConfigurationChanged, onCreateContextMenu, onDisplayHint, onDrawScrollBars, onFilterTouchEventForSecurity, onHoverChanged, onHoverEvent, onKeyLongPress, onOverScrolled, onSetAlpha, onSizeChanged, onWindowSystemUiVisibilityChanged, onWindowVisibilityChanged, overScrollBy, performAccessibilityAction, performClick, performHapticFeedback, performHapticFeedback, playSoundEffect, post, postDelayed, postInvalidate, postInvalidate, postInvalidateDelayed, postInvalidateDelayed, postInvalidateOnAnimation, postInvalidateOnAnimation, postOnAnimation, postOnAnimationDelayed, refreshDrawableState, removeCallbacks, removeOnAttachStateChangeListener, removeOnLayoutChangeListener, requestFitSystemWindows, requestFocus, requestFocus, requestFocus, requestFocusFromTouch, requestLayout, requestRectangleOnScreen, requestRectangleOnScreen, resolveSize, resolveSizeAndState, restoreHierarchyState, saveHierarchyState, scheduleDrawable, scrollBy, scrollTo, sendAccessibilityEventUnchecked, setAccessibilityDelegate, setActivated, setAlpha, setAnimation, setBackground, setBackgroundColor, setBackgroundDrawable, setBackgroundResource, setBottom, setCameraDistance, setClickable, setContentDescription, setDrawingCacheBackgroundColor, setDrawingCacheEnabled, setDrawingCacheQuality, setDuplicateParentStateEnabled, setFadingEdgeLength, setFilterTouchesWhenObscured, setFitsSystemWindows, setFocusable, setFocusableInTouchMode, setHapticFeedbackEnabled, setHasTransientState, setHorizontalFadingEdgeEnabled, setHorizontalScrollBarEnabled, setHovered, setId, setImportantForAccessibility, setKeepScreenOn, setLayerType, setLayoutParams, setLeft, setLongClickable, setMeasuredDimension, setMinimumHeight, setMinimumWidth, setNextFocusDownId, setNextFocusForwardId, setNextFocusLeftId, setNextFocusRightId, setNextFocusUpId, setOnClickListener, setOnCreateContextMenuListener, setOnDragListener, setOnFocusChangeListener, setOnGenericMotionListener, setOnHoverListener, setOnKeyListener, setOnLongClickListener, setOnSystemUiVisibilityChangeListener, setOnTouchListener, setOverScrollMode, setPivotX, setPivotY, setPressed, setRight, setRotation, setRotationX, setRotationY, setSaveEnabled, setSaveFromParentEnabled, setScaleX, setScaleY, setScrollBarDefaultDelayBeforeFade, setScrollBarFadeDuration, setScrollbarFadingEnabled, setScrollBarSize, setScrollBarStyle, setScrollContainer, setScrollX, setScrollY, setSoundEffectsEnabled, setSystemUiVisibility, setTag, setTag, setTop, setTouchDelegate, setTranslationX, setTranslationY, setVerticalFadingEdgeEnabled, setVerticalScrollBarEnabled, setVerticalScrollbarPosition, setVisibility, setWillNotCacheDrawing, setWillNotDraw, setX, setY, showContextMenu, startActionMode, startAnimation, startDrag, unscheduleDrawable, unscheduleDrawable, willNotCacheDrawing, willNotDraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LoginButton

public LoginButton(Context context)
Create the LoginButton.

See Also:
View.View(Context)

LoginButton

public LoginButton(Context context,
                   AttributeSet attrs)
Create the LoginButton by inflating from XML

See Also:
View.View(Context, AttributeSet)

LoginButton

public LoginButton(Context context,
                   AttributeSet attrs,
                   int defStyle)
Create the LoginButton by inflating from XML and applying a style.

See Also:
View.View(Context, AttributeSet, int)
Method Detail

setOnErrorListener

public void setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
Sets an OnErrorListener for this instance of LoginButton to call into when certain exceptions occur.

Parameters:
onErrorListener - The listener object to set

getOnErrorListener

public LoginButton.OnErrorListener getOnErrorListener()
Returns the current OnErrorListener for this instance of LoginButton.

Returns:
The OnErrorListener

setDefaultAudience

public void setDefaultAudience(SessionDefaultAudience defaultAudience)
Sets the default audience to use when the session is opened. This value is only useful when specifying write permissions for the native login dialog.

Parameters:
defaultAudience - the default audience value to use

getDefaultAudience

public SessionDefaultAudience getDefaultAudience()
Gets the default audience to use when the session is opened. This value is only useful when specifying write permissions for the native login dialog.

Returns:
the default audience value to use

setReadPermissions

public void setReadPermissions(List<String> permissions)
Set the permissions to use when the session is opened. The permissions here can only be read permissions. If any publish permissions are included, the login attempt by the user will fail. The LoginButton can only be associated with either read permissions or publish permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the same instance of LoginButton will result in an exception being thrown unless clearPermissions is called in between.

This method is only meaningful if called before the session is open. If this is called after the session is opened, and the list of permissions passed in is not a subset of the permissions granted during the authorization, it will log an error.

Since the session can be automatically opened when the LoginButton is constructed, it's important to always pass in a consistent set of permissions to this method, or manage the setting of permissions outside of the LoginButton class altogether (by managing the session explicitly).

Parameters:
permissions - the read permissions to use
Throws:
UnsupportedOperationException - if setPublishPermissions has been called

setPublishPermissions

public void setPublishPermissions(List<String> permissions)
Set the permissions to use when the session is opened. The permissions here should only be publish permissions. If any read permissions are included, the login attempt by the user may fail. The LoginButton can only be associated with either read permissions or publish permissions, but not both. Calling both setReadPermissions and setPublishPermissions on the same instance of LoginButton will result in an exception being thrown unless clearPermissions is called in between.

This method is only meaningful if called before the session is open. If this is called after the session is opened, and the list of permissions passed in is not a subset of the permissions granted during the authorization, it will log an error.

Since the session can be automatically opened when the LoginButton is constructed, it's important to always pass in a consistent set of permissions to this method, or manage the setting of permissions outside of the LoginButton class altogether (by managing the session explicitly).

Parameters:
permissions - the read permissions to use
Throws:
UnsupportedOperationException - if setReadPermissions has been called
IllegalArgumentException - if permissions is null or empty

clearPermissions

public void clearPermissions()
Clears the permissions currently associated with this LoginButton.


setLoginBehavior

public void setLoginBehavior(SessionLoginBehavior loginBehavior)
Sets the login behavior for the session that will be opened. If null is specified, the default (SessionLoginBehavior.SSO_WITH_FALLBACK will be used.

Parameters:
loginBehavior - The SessionLoginBehavior that specifies what behaviors should be attempted during authorization.

getLoginBehavior

public SessionLoginBehavior getLoginBehavior()
Gets the login behavior for the session that will be opened. If null is returned, the default (SessionLoginBehavior.SSO_WITH_FALLBACK will be used.

Returns:
loginBehavior The SessionLoginBehavior that specifies what behaviors should be attempted during authorization.

setApplicationId

public void setApplicationId(String applicationId)
Set the application ID to be used to open the session.

Parameters:
applicationId - the application ID to use

getUserInfoChangedCallback

public LoginButton.UserInfoChangedCallback getUserInfoChangedCallback()
Gets the callback interface that will be called when the current user changes.

Returns:
the callback interface

setUserInfoChangedCallback

public void setUserInfoChangedCallback(LoginButton.UserInfoChangedCallback userInfoChangedCallback)
Sets the callback interface that will be called when the current user changes.

Parameters:
userInfoChangedCallback - the callback interface

setSessionStatusCallback

public void setSessionStatusCallback(Session.StatusCallback callback)
Sets the callback interface that will be called whenever the status of the Session associated with this LoginButton changes. Note that updates will only be sent to the callback while the LoginButton is actually attached to a window.

Parameters:
callback - the callback interface

getSessionStatusCallback

public Session.StatusCallback getSessionStatusCallback()
Sets the callback interface that will be called whenever the status of the Session associated with this LoginButton changes.

Returns:
the callback interface

onActivityResult

public boolean onActivityResult(int requestCode,
                                int resultCode,
                                Intent data)
Provides an implementation for onActivityResult that updates the Session based on information returned during the authorization flow. The Activity containing this view should forward the resulting onActivityResult call here to update the Session state based on the contents of the resultCode and data.

Parameters:
requestCode - The requestCode parameter from the forwarded call. When this onActivityResult occurs as part of Facebook authorization flow, this value is the activityCode passed to open or authorize.
resultCode - An int containing the resultCode parameter from the forwarded call.
data - The Intent passed as the data parameter from the forwarded call.
Returns:
A boolean indicating whether the requestCode matched a pending authorization request for this Session.
See Also:
Session.onActivityResult(Activity, int, int, Intent)

setSession

public void setSession(Session newSession)
Set the Session object to use instead of the active Session. Since a Session cannot be reused, if the user logs out from this Session, and tries to log in again, a new Active Session will be used instead.

If the passed in session is currently opened, this method will also attempt to load some user information for display (if needed).

Parameters:
newSession - the Session object to use
Throws:
FacebookException - if errors occur during the loading of user information

onFinishInflate

public void onFinishInflate()
Overrides:
onFinishInflate in class View

setFragment

public void setFragment(Fragment fragment)
Sets the fragment that contains this control. This allows the LoginButton to be embedded inside a Fragment, and will allow the fragment to receive the onActivityResult call rather than the Activity.

Parameters:
fragment - the fragment that contains this control

onAttachedToWindow

protected void onAttachedToWindow()
Overrides:
onAttachedToWindow in class TextView

onDetachedFromWindow

protected void onDetachedFromWindow()
Overrides:
onDetachedFromWindow in class TextView