我有一个问题
private class SessionStatusCallback implements Session.StatusCallback {
@Override
public void call(Session session, SessionState state,
Exception exception) {
if (session.isOpened()) {
getProfileInformation();
informDB();
runOnUiThread(new Runnable() {
@Override
public void run() {
}
});
}
updateView();
}
}
public void getProfileInformation() {
Request.newMeRequest(session, new Request.GraphUserCallback() {
// callback after Graph API response with user object
@Override
public void onCompleted(GraphUser user, Response response) {
if (user != null) {
// String access_token = session.getAccessToken();
profilePictureView.setProfileId(user.getId());
fbuser = new UserInfo(user.getId().toString(), user
.getName().toString(), null, null, null, null, null);
name = "dada";
us = user;
Toast.makeText(getApplicationContext(),
"Name: " + user.getName(), Toast.LENGTH_LONG)
.show();
}
}
}).executeAsync();
Log.e("errorrr", us.getName());
Log.e("errorrr", name);
}
我有一个函数getInformation(),其中我试图用GraphUser中的args创建一个UserInfo对象。 问题是fbuser变为null并且我有NullPointerException
你可以看到我设置了一个变量'name',这是一个字符串但是这个我有同样的问题