How to redirect another activity after successfully login with facebook in android?
I am implementing face book api in my application,I have one login button for Facebook.
Whenever I press this button for Facebook login, it is working fine. Now I want to redirect another activity whil开发者_如何学Pythone I was successfully login with Facebook.
How to implement to do this, how can I implement call back method for that? Please help me.
I have used the Facebook SDK, as can be seen in my example:
mFacebook.authorize(this, new String[] { "friends_birthday", "friends_about_me", "read_friendlists" }, new DialogListener() {
@Override
public void onFacebookError(FacebookError arg0) {
}
@Override
public void onError(DialogError arg0) {
}
@Override
public void onComplete(Bundle arg0) {
//start activity here.
}
@Override
public void onCancel() {
}
});
To start an activity in general (put this in onComplete()
):
Intent intent = new Intent(context, TargetActivity.class);
startActivity(intent);
Also, make sure that you add the Target Activity into your AndroidManifest.xml. You must do this in <activity/>
tags. Without this, your application will crash.
精彩评论