use of org.nuclearfog.twidda.backend.api.holder.TweetUpdate in project Shitter by nuclearfog.
the class TweetUpdater method doInBackground.
@Override
protected Void doInBackground(TweetUpdate... tweets) {
TweetUpdate update = tweets[0];
try {
// upload media first
MediaStream[] mediaStreams = update.getMediaStreams();
long[] mediaIds = new long[mediaStreams.length];
for (int pos = 0; pos < mediaStreams.length; pos++) {
// upload media file and save media ID
mediaIds[pos] = twitter.uploadMedia(mediaStreams[pos]);
}
// upload tweet
if (!isCancelled()) {
twitter.uploadTweet(update, mediaIds);
}
} catch (TwitterException twException) {
this.twException = twException;
} finally {
// close inputstreams
update.close();
}
return null;
}
Aggregations