Example usage for twitter4j Twitter createUserListMember

List of usage examples for twitter4j Twitter createUserListMember

Introduction

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

Prototype

UserList createUserListMember(long listId, long userId) throws TwitterException;

Source Link

Document

Adds a member to a list.

Usage

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

License:Apache License

/**
 * Usage: java twitter4j.examples.list.CreateUserListMember [list id] [user id]
 *
 * @param args message/*from  ww  w  .j  a  v  a 2 s  .  c o m*/
 */
public static void main(String[] args) {
    if (args.length < 2) {
        System.out.println("Usage: java twitter4j.examples.list.CreateUserListMember [list id] [user id]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.createUserListMember(Integer.parseInt(args[0]), Integer.parseInt(args[1]));
        System.out.println("Successfully added the user to the specified list.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to add users: " + te.getMessage());
        System.exit(-1);
    }
}