[英]How to post picture to Twitter using twitter4j library in Android
我想在我的应用程序上将图像发布到Twitter。 我使用“ twitter4j”库仅发布文本。 但是我找不到如何用文字发布图像。 感谢帮助。
从这些服务中获取KEY和TOKEN,然后
/* * Upload File to twitPic and get url . Then append this url to your twitter message. */ public static String upload_twic_pic(File file) throws TwitterException { String url = null; if (file != null) { Configuration conf = new ConfigurationBuilder().setMediaProviderAPIKey(TWITPIC_KEY).build(); ImageUpload upload = new ImageUploadFactory(conf).getInstance(MediaProvider.PLIXI); //Use ImageUploadFactory url = upload.upload(file); } return url;
这是一个文件解决方案的链接,该解决方案确切说明了如何将图片/文本推文集成到android应用中。
您可以使用socialauth android库
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.