List of usage examples for twitter4j Relationship isSourceNotificationsEnabled
boolean isSourceNotificationsEnabled();
From source file:MainActivity.java
private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed try {// w w w.j ava 2s. c o 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:twitter4j.examples.friendship.ShowFriendship.java
License:Apache License
/** * Usage: java twitter4j.examples.friendship.ShowFriendship [source screen name] [target screen name] * * @param args message//from w ww . jav a2 s .co m */ public static void main(String[] args) { if (args.length < 2) { System.out.println( "Usage: java twitter4j.examples.friendship.ShowFriendship [source screen name] [target screen name]"); System.exit(-1); } try { Twitter twitter = new TwitterFactory().getInstance(); Relationship relationship = twitter.showFriendship(args[0], args[1]); System.out.println("isSourceBlockingTarget: " + relationship.isSourceBlockingTarget()); System.out.println("isSourceFollowedByTarget: " + relationship.isSourceFollowedByTarget()); System.out.println("isSourceFollowingByTarget: " + relationship.isSourceFollowingTarget()); System.out.println("isSourceNotificationsEnabled: " + relationship.isSourceNotificationsEnabled()); System.out.println("canSourceDm: " + relationship.canSourceDm()); System.exit(0); } catch (TwitterException te) { te.printStackTrace(); System.out.println("Failed to show friendship: " + te.getMessage()); System.exit(-1); } }