List of usage examples for twitter4j StatusUpdate media
public StatusUpdate media(String name, InputStream body)
From source file:cz.mgn.collabdesktop.utils.apis.twitter.CollabTwitter.java
License:Open Source License
public static void tweet(String roomName, String text, BufferedImage roomImage, String accessToken, String accessTokenSecret) { try {//from www . ja va 2 s . c om ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true) // .setOAuthConsumerKey("PLFCUaLARG3rW66MbME1Kg") // twitter app: MG Collab desktop .setOAuthConsumerSecret("Rf5G5htymWOVnC4KGT5lSzaAzlgW6mUwXNIPnywI8") // .setOAuthAccessToken(accessToken) // .setOAuthAccessTokenSecret(accessTokenSecret); Twitter twitter = new TwitterFactory(cb.build()).getInstance(); StatusUpdate su = new StatusUpdate(text); su.media(roomName, makeInputStreamFromImage(roomImage)); twitter.updateStatus(su); } catch (IOException ex) { Logger.getLogger(CollabTwitter.class.getName()).log(Level.SEVERE, null, ex); } catch (TwitterException ex) { Logger.getLogger(CollabTwitter.class.getName()).log(Level.SEVERE, null, ex); } }