I have been trying to use a normal button to execute the authentication process with the twitter sdk but it does not seem to work. Anyone have tried anything similar?
Since Fabric doesn't allow theming yet, we should assume that we'll have to write potentially throw away code to get this to work. As such, I prefer less code to more code when I know I won't be keeping it.
Luis's solution will work fine, but my UI was done, with a button already, and I just wanted that button to work. Here's how I accomplished this.
Drop in the TwitterLoginButton, as requested by the Fabric wizard, but set it to visibility: gone
Pull the reference of the loginButton in your Activity (also part of Fabric setup - nothing new here):
loginButton = (TwitterLoginButton) findViewById(R.id.twitter_login_button);
Finally, for my existing button, I added a click listener, which simply delegated the click event over to the twitter login button.
myLoginButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
loginButton.performClick();
}
});
Worked like a charm.