问题
I want to share multiple images along with the tweet on the Twitter, but i am not able to do so. I am able to tweet single photo along with the message but not getting to append other photos in the same tweet since twitter does not allow to tweet the same message for 8-10 hours or even a day. Here is my code, what i have done to tweet the message along the photo. Can anyone please let me know where i am lacking in the code or any better way to implement the requirement.
Here is the code for tweeting:
AccessToken accessToken = new AccessToken(access_token,
access_token_secret);
Twitter twitter = new TwitterFactory(builder.build())
.getInstance(accessToken);
File f = new File(Environment.getExternalStorageDirectory()
.getAbsolutePath().toString()
+ "/xyz.png");
StatusUpdate statusUpdate = new StatusUpdate(status);
statusUpdate.setMedia(f);
twitter.updateStatus(statusUpdate);
Thanks in advance
回答1:
After doing lot of R & D, i came to know that we can not post more than one image in a single tweet, and also Twitter does not allow same message to be twitted in short span of time. You can post it after several hours(may be around 7-8 hours), since it gives "Duplicate message error". So i called the function which helped posting tweet with the media file by taking one counter variable and checking with the list of images i had. So at the end i was able to post three different tweets as there were three images in my list.
And ya, you can check in this link in which you will come to know the number of images you can post in a single tweet
来源:https://stackoverflow.com/questions/20113844/posting-multiple-photos-in-a-single-tweet