我正在尝试将 twitter 集成到 android 中,我已按照以下链接中的教程进行操作 http://www.androidhive.info/2012/09/android-twitter-oauth-connect-tutorial/
但我在这些行的 loginwithTwitter 函数中遇到异常
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();
}
我得到的 e.getMessage() 为 null 并且在这一行发生了异常
requestToken = twitter.getOAuthRequestToken(TWITTER_CALLBACK_URL);
请帮我解决这个问题。我还在互联网上搜索过,在 stackoverflow 上搜索过类似的查询,例如 Android twitter login not working 和 Twitter Login Authentication in Android? 所以请帮助我,我正在使用 twitter4j-4.0.1
最佳答案
我遇到了同样的问题。我引用了本教程并且它有效 - http://hintdesk.com/how-to-tweet-in-twitter-within-android-client/comment-page-1/
而且他们已经更新到 twitter4j-core-4.0.1
可在此处找到源代码 - https://bitbucket.org/hintdesk/android-how-to-tweet-in-twitter-within-android-client
关于android - 使用 twitter4j-4.0.1 在 android 中集成 Twitter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22543102/