Twitter Sign In button problems


Hi, I’ve had a few problems integration the twitter sign in button into our application.

Firstly, the button complained about getActivity (see full error below [1]). I am using the button inside a dialog fragment. I first tried subclassing, and passing an activity through the constructor, to be returns in getActivity. Unfortunately the button seems to read getActivity in the constructor, so the only way to get this to work was to use a nested subclass inside the fragment I was using the button in. Is there any other way to solve this problem? Why does the button need an activity to work?

Second, OnActivityResult. Again, because I’m using a fragment, passing the results into the fragment were quite tricky. I solved it fine but fragments already have an onActivityResult. This isn’t called though, I suspect because the twitter button is using the activity passed in that I mentioned above to start the twitter activity for result.

Thirdly, the button seems to only be usable once per app launch. If another part of my sign in fails, or a user logs out, they twitter log in button will no longer work. Any help on this front?



[1] Full error was “TwitterLoginButton requires an activity. Override getActivity to provide the activity for this button.”;



Have you looked at

We’ll investigate the issue with the button being usable once per app launch.


closed #3