Login flow gets stuck, shows strange behavior [Android]


#1

I have followed the standard instructions for utilizing the LoginButton in a fragment, including defering the onActivityResult to the corresponding fragment. But I face the following situation:

The first time the button is pressed, the Twitter app launches as expected.
Then I press authorize, and control returns to my app and the “Using SSO” message is logged, but I get no call whatsoever to any of the methods in the callback that I set in onCreateView.
If I try to press the login button again, “Using OAuth” is logged instead and an error is thrown with the complaint of an authentication being already in progress. Interestingly enough, this time I do get a call to the failure method in the callback.

Any clues on what could I possibly have done wrong?


#2

Alright so it seems that what I did wrong was following the guidelines. They indicate that, if you are using a fragment, you should pass the result from the Activity to the Fragment instead of to the button (which is anyway a very bad idea to do from the Activity because the button is in the fragment, not in the Activity straightforward). Therefore what you have to do is pass the result to the Activity and, from the Fragment, pass the result to the button. May seem like obvious if you think it from the outside, but this is not what the documentation says…


#3