this.context().parent().tell(new StatusUpdate(i)); long j = 1;
/** * To upload a picture with some piece of text. * * * @param file The file which we want to share with our tweet * @param message Message to display with picture * @param twitter Instance of authorized Twitter class * @throws Exception exception if any */ public void uploadPic(File file, String message,Twitter twitter) throws Exception { try{ StatusUpdate status = new StatusUpdate(message); status.setMedia(file); twitter.updateStatus(status);} catch(TwitterException e){ Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); throw e; } }
@Override public ImportResult importItem( UUID jobId, TokenSecretAuthData authData, PhotosContainerResource data) { Twitter twitterApi = TwitterApiWrapper.getInstance(appCredentials, authData); // Twitter doesn't support an 'Albums' concept, so that information is just lost. for (PhotoModel image : data.getPhotos()) { try { StatusUpdate update = new StatusUpdate(image.getDescription()); InputStreamContent content = new InputStreamContent(null, getImageAsStream(image.getFetchableUrl())); update.media(image.getTitle(), content.getInputStream()); twitterApi.tweets().updateStatus(update); } catch (IOException | TwitterException e) { monitor.severe(() -> "Error importing twitter photo", e); return new ImportResult(e); } } return new ImportResult(ResultType.OK); }
public void uploadPic(File file, String message) throws Exception { try{ StatusUpdate status = new StatusUpdate(message); status.setMedia(file); mTwitter.updateStatus(status);} catch(TwitterException e){ Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); throw e; } }
/** * To upload a picture with some piece of text. * * * @param file The file which we want to share with our tweet * @param message Message to display with picture * @param twitter Instance of authorized Twitter class * @throws Exception exception if any */ public void uploadPic(File file, String message,Twitter twitter) throws Exception { try{ StatusUpdate status = new StatusUpdate(message); status.setMedia(file); twitter.updateStatus(status);} catch(TwitterException e){ Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); throw e; } }
StatusUpdate status = new StatusUpdate("Listening "+"https://www.google.co.in/");
public void tweetPicture(File file, String message) throws Exception { try{ StatusUpdate status = new StatusUpdate(message); status.setMedia(file); mTwitter.updateStatus(status);} catch(TwitterException e){ Log.d("TAG", "Pic Uploading error" + e.getErrorMessage()); throw e; } }
StatusUpdate statusUpdate = new StatusUpdate("Hello Twitter"); String imageUrl = "http://example.com/image.png"; URL url = new URL(imageUrl); URLConnection urlConnection = url.openConnection(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); statusUpdate.setMedia("image.png", in); twitter4j.Status status = twitter.updateStatus(statusUpdate); //might be a good idea to close the inputstream in a finally block
String answer = "replying to @" + userNick + ": ..."; StatusUpdate statusReply = new StatusUpdate(answer); statusReply.setInReplyToStatusId(statusId); try { twitter.updateStatus(statusReply); } catch (TwitterException ex) { // handle exception }
public void tweet(File f, String Message) throws TwitterException { StatusUpdate status = new StatusUpdate(Message); status.setMedia(f); // twitter is an object of Twitter for which you have set the authentication token twitter.updateStatus(status); }
final StatusUpdate statusUpdate = new StatusUpdate("Hallee hallo my status java.lang.String here..."); // now do as you did until: ByteArrayOutputStream baos = new ByteArrayOutputStream(); bm.compress(Bitmap.CompressFormat.PNG, 100, baos); imageBytes = baos.toByteArray(); encodedImage = Base64.encodeToString(imageBytes, Base64.DEFAULT); // then flip the stream byte[] myTwitterUploadBytes = bos.toByteArray(); ByteArrayInputStream bis = new ByteArrayInputStream(myTwitterUploadBytes); // doo and double check your encoding etc, similar to in your question.. statusUpdate.setMedia("give me a java.lang.String name", bis); // then continue just using twitter for j- update status as you would //... get twitter etc... // twitter4j.Status response = twitter.updateStatus(statusUpdate);
public void uploadPic(String message, String getImgUrl) throws Exception { try { System.out.println(" ON UPLOAD PIC FUNCTION getImgUrl "+getImgUrl); // URL url = new URL("http://faveplatewebservice.siplstudio.com/uploads/big_dish/oooo14n7464rO4_thumb.png"); URL url = new URL(getImgUrl); URLConnection urlConnection = url.openConnection(); InputStream in = new BufferedInputStream(urlConnection.getInputStream()); StatusUpdate status = new StatusUpdate("Check Out FavPlates on appstore, which offers you to add and find exciting dishes near you. "+message); //status.setMedia(file); status.setMedia("Check Out FavPlates on appstore, which offers you to add and find exciting dishes near you. "+message, in); mTwitter.updateStatus(status); } catch (TwitterException e) { Log.d("TAG", "Pic Upload error" + e.getExceptionCode()); throw e; } }
public void Share_Pic_Text_Titter(File image_path, String message, Twitter twitter) throws Exception { try { StatusUpdate st = new StatusUpdate(message); st.setMedia(image_path); twitter.updateStatus(st); } catch (TwitterException e) { Log.d("Error==>", "Pic Upload error" + e.getErrorMessage()); throw e; } }
Twitter twitter = new TwitterFactory().getInstance(); twitter.updateStatus(new StatusUpdate("@USERNAME").inReplyToStatusId(STATUSID));
/** * To upload a picture with some piece of text. * * * @param file The file which we want to share with our tweet * @param message Message to display with picture * @param twitter Instance of authorized Twitter class * @throws Exception exception if any */ public void uploadPic(File file, String message,Twitter twitter) throws Exception { try{ StatusUpdate status = new StatusUpdate(message); status.setMedia(file); twitter.updateStatus(status); } catch(TwitterException e){ Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); throw e; } }
** * To upload a picture with some piece of text. * * * @param file The file which we want to share with our tweet * @param message Message to display with picture * @param twitter Instance of authorized Twitter class * @throws Exception exception if any */ public void uploadPic(File file, String message,Twitter twitter) throws Exception { try{ StatusUpdate status = new StatusUpdate(message); status.setMedia(file); twitter.updateStatus(status);} catch(TwitterException e){ Log.d("TAG", "Pic Upload error" + e.getErrorMessage()); throw e; } }
public void onStatus(Status status) { System.out.println("onStatus @" + status.getUser().getScreenName() + " - "+ status.getText()); System.out.println(status.getInReplyToUserId()); Twitter tf = new TwitterFactory().getInstance(); StatusUpdate st = new StatusUpdate("hello"); st.inReplyToStatusId(status.getId()); try { tf.updateStatus(st); } catch (TwitterException e) { // TODO Auto-generated catch block e.printStackTrace(); } }
private void replyTo(final Status status, final String reply, final boolean prefix) throws TwitterException { final String message; if (prefix) { message = "@" + status.getUser().getScreenName() + " " + reply; } else { message = reply; } final StatusUpdate statusUpdate = new StatusUpdate(message); statusUpdate.setInReplyToStatusId(status.getId()); twitter.updateStatus(statusUpdate); }
public static void reply(long inReplyToStatusId,String text,double latitude,double longitude,TwitterFactory factory) throws TwitterException { AccessToken accessToken = loadAccessToken(); Twitter twitter = factory.getInstance(); twitter.setOAuthConsumer(consumerKey, consumerSecrate); twitter.setOAuthAccessToken(accessToken); StatusUpdate stat= new StatusUpdate(text); stat.setInReplyToStatusId(inReplyToStatusId); GeoLocation location= new GeoLocation(latitude, longitude); stat.setLocation(location); twitter.updateStatus(stat); }'
String accesst = "ACCESS_TOKEN"; String accessts = "TOKEN_SECRET"; ConfigurationBuilder builder = new ConfigurationBuilder(); builder.setOAuthAccessToken(accesst); builder.setOAuthAccessTokenSecret(accessts); builder.setOAuthConsumerKey("CLIENT_ID"); builder.setOAuthConsumerSecret("CLIENT_SECRET"); OAuthAuthorization auth = new OAuthAuthorization(builder.build()); Twitter twitter_auth = new TwitterFactory().getInstance(auth); String screenName = twitter_auth.getScreenName(); StatusUpdate status = new StatusUpdate("STATUS_TEXT"); status.setMedia(new File("YOUR_FILE_PATH"));// BY SPECIFYING FILE PATH //status.setMedia("File name", new FileInputStream("")); // By InputStream Status updateStatus = twitter_auth.updateStatus(status); long id = updateStatus.getId(); // id of the status posted