|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectandroid.view.View
android.widget.TextView
android.widget.Button
com.facebook.widget.LoginButton
public class LoginButton
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 theSessionState.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 |
Field Summary |
---|
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 java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LoginButton(Context context)
View.View(Context)
public LoginButton(Context context, AttributeSet attrs)
View.View(Context, AttributeSet)
public LoginButton(Context context, AttributeSet attrs, int defStyle)
View.View(Context, AttributeSet, int)
Method Detail |
---|
public void setOnErrorListener(LoginButton.OnErrorListener onErrorListener)
onErrorListener
- The listener object to setpublic LoginButton.OnErrorListener getOnErrorListener()
public void setDefaultAudience(SessionDefaultAudience defaultAudience)
defaultAudience
- the default audience value to usepublic SessionDefaultAudience getDefaultAudience()
public void setReadPermissions(List<String> permissions)
permissions
- the read permissions to use
UnsupportedOperationException
- if setPublishPermissions has been calledpublic void setPublishPermissions(List<String> permissions)
permissions
- the read permissions to use
UnsupportedOperationException
- if setReadPermissions has been called
IllegalArgumentException
- if permissions is null or emptypublic void clearPermissions()
public void setLoginBehavior(SessionLoginBehavior loginBehavior)
SessionLoginBehavior.SSO_WITH_FALLBACK
will be used.
loginBehavior
- The SessionLoginBehavior
that
specifies what behaviors should be attempted during
authorization.public SessionLoginBehavior getLoginBehavior()
SessionLoginBehavior.SSO_WITH_FALLBACK
will be used.
SessionLoginBehavior
that
specifies what behaviors should be attempted during
authorization.public void setApplicationId(String applicationId)
applicationId
- the application ID to usepublic LoginButton.UserInfoChangedCallback getUserInfoChangedCallback()
public void setUserInfoChangedCallback(LoginButton.UserInfoChangedCallback userInfoChangedCallback)
userInfoChangedCallback
- the callback interfacepublic void setSessionStatusCallback(Session.StatusCallback callback)
callback
- the callback interfacepublic Session.StatusCallback getSessionStatusCallback()
public boolean onActivityResult(int requestCode, int resultCode, Intent data)
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.
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.
Session.onActivityResult(Activity, int, int, Intent)
public void setSession(Session newSession)
newSession
- the Session object to use
FacebookException
- if errors occur during the loading of user informationpublic void onFinishInflate()
onFinishInflate
in class View
public void setFragment(Fragment fragment)
onActivityResult
call rather than the Activity.
fragment
- the fragment that contains this controlprotected void onAttachedToWindow()
onAttachedToWindow
in class TextView
protected void onDetachedFromWindow()
onDetachedFromWindow
in class TextView
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |