Error: :cannot resolve method "loginButton.setCallback(new Callback<TwitterSession>()"


#1
 Button loginButton = (TwitterLoginButton)
                findViewById(R.id.login_button);
         loginButton.setCallback(new Callback<TwitterSession>() {
            @Override
            public void success(Result<TwitterSession> result) {
                // Do something with result, which provides a
                // TwitterSession for making API calls
            }

            @Override
            public void failure(TwitterException exception) {
                // Do something on failure
            }
        });



//Error in  setCallback


#2

You might want to choose a proper title which is a bit less cryptic and in brief describes what your post is about. In your post then explain further what your problem is and what you did that made it happen.
If you include code, please indent it with 4 spaces or what it in 3 backticks at the start (`) and end (each on a newline), so it is formatted properly.


#4

Hey.
I’m having the same problem too
Have you solved yours? If so, HOW PLEASE???
Thank you


#5

You should definitely change your attitude… I just pointed out that pasting a super long error message into the title might not be the best, as this is not what the Title is for.
A better title for example would be “Error setting callback of loginButton” or such. I just proposed this to increase the chance someone finds this and has an answer to it.
Additionally writing two times that you have the same problem and need help, will not help as it was clear the first time you wrote it.


#6

I’ve reformatted your code.

I believe you’re saying that you cannot compile the code fragment due to the method error in the title.

Can you provide any more information about your setup:

  • Eclipse or Android Studio?
  • which Android version are you targetting?
  • have you imported TwitterSession / TwitterCore and do you have your classpath setup properly (the Fabric wizard should have been able to help you with setting up your Gradle build correctly, but just checking).

#7

I think you should declare your loginButton as TwitterLoginButton loginButton not just like a normal button that doesn’t have a method called setCallback()


#8