Session.StatusCallback cannot be resolved to a type - Facebook API

Rucha Heda picture Rucha Heda · Jun 4, 2013 · Viewed 10.4k times · Source

I followed the login authentication tutorial on Facebook and have copied the following code into my android application

private Session.StatusCallback callback = 
    new Session.StatusCallback()
{
    @Override
    public void call(Session session, 
            SessionState state, Exception exception) {
        onSessionStateChange(session, state, exception);
    }
};

However, it is giving me the following errors:

Session.StatusCallback cannot be resolved to a type

Which is leading to the following errors:

callback cannot be resolved to a variable

There's also other places where Facebook API calls are made that are giving me errors, but it's not in all the Facebook API calls. Another place I'm getting an error is the following:

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();

where it does not recognize Request.GraphUserCallback, and then executeAsync(). I get the following errors:

Request.GraphUserCallback cannot be resolved to a type
The method executeAsync() is undefined for the type DownloadManager.Request

Does anyone have any advice as to how to fix this?

Thank you for your help in advance!!

Answer

user2688443 picture user2688443 · Aug 16, 2013

I had the same problem as your first one, and I solved it by removing

import android.service.textservice.SpellCheckerService.Session;

and adding

import com.facebook.Session;