您可以使用 twitter4j-core-3.0.2.jar twitter4j-media-support-3.0.2.jar 库在 twitter 上共享图像和测试。例子
String token = prefs.getString(OAuth.OAUTH_TOKEN, "");
String secret = prefs.getString(OAuth.OAUTH_TOKEN_SECRET, "");
AccessToken a = new AccessToken(token, secret);
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(Constants.CONSUMER_KEY, Constants.CONSUMER_SECRET);
twitter.setOAuthAccessToken(a);
ConfigurationBuilder cb = new ConfigurationBuilder();
cb.setDebugEnabled(true).setOAuthConsumerKey(yourConsumerKey).setOAuthConsumerSecret(yourConsumerSeceret).setOAuthAccessToken(yourAccessToken).setOAuthAccessTokenSecret(yourAccessTokenSeceret);
Configuration conf = cb.build();
ImageUploadFactory factory = new ImageUploadFactory(conf);
ImageUpload upload = factory.getInstance();
String url = upload.upload(yourImage, yourCaptionWithImage); //image is a File Format and Caption is String
参考链接:
1) http://www.londatiga.net/it/how-to-send-image-to-twitpic-from-android/
2) http://www.rqna.net/qna/wupzh-android-image-sharing-on-twitter-using-sdk.html