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

 Button loginButton = (TwitterLoginButton)
         loginButton.setCallback(new Callback<TwitterSession>() {
            public void success(Result<TwitterSession> result) {
                // Do something with result, which provides a
                // TwitterSession for making API calls

            public void failure(TwitterException exception) {
                // Do something on failure

//Error in  setCallback


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.


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


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.


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).


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

closed #8