我遵循 Facebook 上的登录身份验证教程,并将以下代码复制到我的 android 应用程序中
private Session.StatusCallback callback =
new Session.StatusCallback()
{
@Override
public void call(Session session,
SessionState state, Exception exception) {
onSessionStateChange(session, state, exception);
}
};
但是,它给了我以下错误:
Session.StatusCallback cannot be resolved to a type
这导致以下错误:
callback cannot be resolved to a variable
还有其他地方进行 Facebook API 调用时会出现错误,但这并不是在所有 Facebook API 调用中。我收到错误的另一个地方如下:
Request request = Request.newMeRequest(session,
new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser user, Response response) {
// If the response is successful
if (session == Session.getActiveSession()) {
if (user != null) {
// Set the id for the ProfilePictureView
// view that in turn displays the profile picture.
Log.d("MainActivity", "onComplete() User logged in");
parent.owner = MainKickback.userConnection.add(new User(user.getId()));
EventFragment e = (EventFragment) fragments[UPCOMING_EVENTS];
e.populateEvents();
}
}
if (response.getError() != null) {
// Handle errors, will do so later.
}
}
});
request.executeAsync();
它无法识别 Request.GraphUserCallback,然后执行 Async()。我收到以下错误:
Request.GraphUserCallback cannot be resolved to a type
The method executeAsync() is undefined for the type DownloadManager.Request
有人对如何解决这个问题有任何建议吗?
提前谢谢你的帮助!!