List of usage examples for twitter4j Relationship getTargetUserScreenName
String getTargetUserScreenName();
From source file:MainActivity.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed try {//from www .j av a 2 s . co m Relationship r = twitter.showFriendship(uu1.getText(), uu2.getText()); String s = r.getSourceUserScreenName() + " is "; if (r.isSourceFollowingTarget()) { s = s + " following " + r.getTargetUserScreenName(); if (r.isSourceFollowedByTarget()) { s = s + " aslo " + r.getSourceUserScreenName() + " is followed by " + r.getTargetUserScreenName(); } else { s = s + " but " + r.getSourceUserScreenName() + " is not followed by " + r.getTargetUserScreenName(); } } else { s = s + " not following " + r.getTargetUserScreenName(); if (r.isSourceFollowedByTarget()) { s = s + " interestingly " + r.getSourceUserScreenName() + " is followed by " + r.getTargetUserScreenName(); } else { s = s + " neither " + r.getSourceUserScreenName() + " is followed by " + r.getTargetUserScreenName(); } } if (r.isSourceNotificationsEnabled()) { s = s + ", " + r.getSourceUserScreenName() + " has enabled notification for " + r.getTargetUserScreenName(); } else { s = s + ", " + r.getSourceUserScreenName() + " has no intention of enabling notification for " + r.getTargetUserScreenName(); } if (r.isSourceBlockingTarget()) { s = s + " its strange but " + r.getSourceUserScreenName() + " is blocking " + r.getTargetUserScreenName(); } else { s = s + " needless to say " + r.getSourceUserScreenName() + " is not blocking " + r.getTargetUserScreenName(); } u1.setText(s); // TODO add your handling code here: } catch (TwitterException ex) { Logger.getLogger(MainActivity.class.getName()).log(Level.SEVERE, null, ex); } }
From source file:info.maslowis.twitterripper.command.impl.twitter.FriendUpdateId.java
License:Open Source License
@Override public void execute() throws ExecuteCmdException { try {/*from w w w . j a va2 s . c o m*/ Relationship relationship = twitter.updateFriendship(id, device, retweets); out.println(String.format("Changed the notification settings from User{id=%1s, screenName='%2s'}", relationship.getTargetUserId(), relationship.getTargetUserScreenName())); } catch (TwitterException e) { throw new ExecuteCmdException(e); } }
From source file:info.maslowis.twitterripper.command.impl.twitter.FriendUpdateName.java
License:Open Source License
@Override public void execute() throws ExecuteCmdException { try {//from w w w . j a v a 2 s . c om Relationship relationship = twitter.updateFriendship(name, device, retweets); out.println(String.format("Changed the notification settings from User{id=%1s, screenName='%2s'}", relationship.getTargetUserId(), relationship.getTargetUserScreenName())); } catch (TwitterException e) { throw new ExecuteCmdException(e); } }
From source file:twitter4j.examples.friendship.UpdateFriendship.java
License:Apache License
/** * Usage: java twitter4j.examples.user.UpdateFriendship [screen name] [enable device notification(true|false)] [enable retweets(true|false)] * * @param args message/*from ww w.j a v a 2 s . c om*/ */ public static void main(String[] args) { if (args.length < 3) { System.out.println( "Usage: java twitter4j.examples.user.UpdateFriendship [screen name] [enable device notification(true|false)] [enable retweets(true|false)]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); Relationship relationship = twitter.updateFriendship(args[0], Boolean.parseBoolean(args[1]), Boolean.parseBoolean(args[2])); System.out.println( "Successfully updated the friendship of [" + relationship.getTargetUserScreenName() + "]."); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to update the friendship: " + te.getMessage()); System.exit(-1); } }