Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Log In Button Greyed Out

I'm trying to implement logging in with twitter in my app. I just came across news that states that Fabric was sold to Google. I am not using Fabric in my application. Instead I am using the twitter core sdk com.twitter.sdk.android:twitter-core:3.1.1 . I try to initialise Twitter but the login button is still greyed out with this code:

TwitterConfig config = new TwitterConfig.Builder(this)
                .logger(new DefaultLogger(Log.DEBUG))
                .twitterAuthConfig(new TwitterAuthConfig(getString(R.string.twitter_key), getString(R.string.twitter_secret)))
                .debug(true)
                .build();
        Twitter.initialize(config);


I see the following error output in my logcat
E/Twitter: Must initialize Twitter before using getInstance()

How can I go about this error?

like image 731
Manny265 Avatar asked Sep 09 '17 18:09

Manny265


People also ask

Why is the tweet button Greyed out?

Those unable to reply to tweets will see the option greyed out in the same way those who protect their tweets from being retweeted. The default setting will continue to be 'everyone' unless the user states otherwise. The setting won't affect who can like, retweet, retweet with comment and share the tweet.

Why is my reply button Greyed out in Twitter?

If you can't reply to a tweet, the reply icon will be greyed out so that it's clear for people they aren't able to reply - just as the retweet button is currently for a tweet from a locked account.


1 Answers

To solve the problem, I took my Twitter.initialize(TwitterConfig) statement before Android's setContentView() method and problem solved:

Sample Code

 TwitterConfig config = new TwitterConfig.Builder(this)
            .logger(new DefaultLogger(Log.DEBUG))
            .twitterAuthConfig(new TwitterAuthConfig(getString(R.string.twitter_key), getString(R.string.twitter_secret)))
            .debug(true)
            .build();
    Twitter.initialize(config);
    setContentView(R.layout.activity_login);
    mLoginButton = (TwitterLoginButton) findViewById(R.id.login_twitter);
    mLoginButton.setCallback(new Callback<TwitterSession>() {}
like image 144
Manny265 Avatar answered Oct 21 '22 05:10

Manny265