我正在整合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()未執行 –