user3313379
user3313379

Reputation: 489

Twitter Integration in android using twitter4j-4.0.1

I am try to integrate twitter in android I have followed tutorial from following link http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/

But I am facing an exception in loginwithTwitter function at these lines

ConfigurationBuilder builder = new ConfigurationBuilder();
        builder.setOAuthConsumerKey(TWITTER_CONSUMER_KEY);
        builder.setOAuthConsumerSecret(TWITTER_CONSUMER_SECRET);
        Configuration configuration = builder.build();
        TwitterFactory factory = new TwitterFactory(configuration);
        twitter = factory.getInstance();
        try {
            requestToken = twitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);
            this.startActivity(new Intent(Intent.ACTION_VIEW,
            Uri.parse(requestToken.getAuthenticationURL())));

        } catch (TwitterException e) {
            e.printStackTrace();
            Toast.makeText(getApplicationContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
        }

I got e.getMessage() as null and exception occures at this line

requestToken = twitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);

Please help me solve this problem. I have also searched on internet and others queries like this on stackoverflow like Android twitter login not working and Twitter Login Authentication in Android? So kindly help me I am using twitter4j-4.0.1

Upvotes: 3

Views: 6110

Answers (2)

Guy Smith
Guy Smith

Reputation: 178

Example code is at "https://github.com/gingerdroids/TwitterLogin".

I had difficulty getting Twitter login with Android and twitter4j going. Finally got there and uploaded a small sample app TwitterLogin to GitHub.

Upvotes: 0

Rushikesh Gomekar
Rushikesh Gomekar

Reputation: 608

I was having the same problem. I referred to this tutorial and it works - http://hintdesk.com/how-to-tweet-in-twitter-within-android-client/comment-page-1/

and also they have updated to twitter4j-core-4.0.1

Source code can be found here - https://bitbucket.org/hintdesk/android-how-to-tweet-in-twitter-within-android-client

Upvotes: 5

Related Questions