我正在整合Facebook登录我的Android应用程序 我已成功登录到Facebook从应用程序和成功后,我打开一个活动。获取facebook用户名称在Android应用程序
private FacebookCallback<LoginResult> callback = new FacebookCallback<LoginResult>() {
@Override
public void onSuccess(LoginResult loginResult) {
AccessToken accessToken = loginResult.getAccessToken();
Profile profile = Profile.getCurrentProfile();
// String fbname = profile.getName();
//AppLog.Log("name",);
Intent intent = new Intent(getApplicationContext(), ComputerCategoryActivity.class);
startActivity(intent);
}
现在我想发送Facebook个人资料的用户名。对于这一点,如果我从上面的代码中删除注释,并试图通过这条线得到它:
String fbname = profile.getName();
我登录到FB,但因此它是进入onSuccess()
方法的应用是不开放的活动。请帮我为什么不能用Profile.getCurrentProfile();
实际上它没有崩溃但没有打开指定的活动,这意味着onSuccess()未执行 –