Example usage for twitter4j Relationship getSourceUserScreenName

List of usage examples for twitter4j Relationship getSourceUserScreenName

Introduction

In this page you can find the example usage for twitter4j Relationship getSourceUserScreenName.

Prototype


String getSourceUserScreenName();

Source Link

Document

Returns the source user screen name

Usage

From source file:MainActivity.java

private void jButton5ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton5ActionPerformed

    try {//from  w  w  w  .  j  av  a 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);
    }
}