Example usage for twitter4j Twitter createUserList

List of usage examples for twitter4j Twitter createUserList

Introduction

In this page you can find the example usage for twitter4j Twitter createUserList.

Prototype

UserList createUserList(String listName, boolean isPublicList, String description) throws TwitterException;

Source Link

Document

Creates a new list for the authenticated user.

Usage

From source file:twitter4j.examples.list.CreateUserList.java

License:Apache License

/**
 * Usage: java twitter4j.examples.list.CreateUserList [list name] [list description]
 *
 * @param args message//ww  w . j a va  2  s  . c om
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.list.CreateUserList [list name] [list description]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        String description = null;
        if (args.length >= 2) {
            description = args[1];
        }
        UserList list = twitter.createUserList(args[0], true, description);
        System.out
                .println("Successfully created a list (id:" + list.getId() + ", slug:" + list.getSlug() + ").");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to create a list: " + te.getMessage());
        System.exit(-1);
    }
}