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 を認識せず、次に executeAsync() を認識しません。次のエラーが表示されます。
Request.GraphUserCallback cannot be resolved to a type
The method executeAsync() is undefined for the type DownloadManager.Request
これを修正する方法について誰かアドバイスはありますか?
よろしくお願いします!