Example usage for twitter4j Friendship getScreenName

List of usage examples for twitter4j Friendship getScreenName

Introduction

In this page you can find the example usage for twitter4j Friendship getScreenName.

Prototype

String getScreenName();

Source Link

Usage

From source file:com.SocialAccess.TwitterSearch.java

public static void ShowFriendsListNames() {
    List<String[]> data = CSVutil.readCSV(Constants.CSV_FILE_NAME);
    String[] people = data.get(0);
    try {//from ww w  .  j a  v  a2  s  . c  o m
        Twitter twitter = new TwitterFactory().getInstance();
        ResponseList<Friendship> friendships = twitter.lookupFriendships(people);
        for (Friendship friendship : friendships) {
            System.out.println("@" + friendship.getScreenName() + " following: " + friendship.isFollowing()
                    + " followed_by: " + friendship.isFollowedBy());
        }
        System.out.println("Successfully looked up friendships [" + people[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to lookup friendships: " + te.getMessage());
        System.exit(-1);
    }
}

From source file:twitter4j.examples.friendship.LookupFriendships.java

License:Apache License

/**
 * Usage: java twitter4j.examples.user.LookupFriendships [screen name[,screen name..]]
 *
 * @param args message// ww w  .j av a2 s  . c  om
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out
                .println("Usage: java twitter4j.examples.user.LookupFriendships [screen name[,screen name..]]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        ResponseList<Friendship> friendships = twitter.lookupFriendships(args[0].split(","));
        for (Friendship friendship : friendships) {
            System.out.println("@" + friendship.getScreenName() + " following: " + friendship.isFollowing()
                    + " followed_by: " + friendship.isFollowedBy());
        }
        System.out.println("Successfully looked up friendships [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to lookup friendships: " + te.getMessage());
        System.exit(-1);
    }
}