Example usage for twitter4j Twitter getUserListMembers

List of usage examples for twitter4j Twitter getUserListMembers

Introduction

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

Prototype

PagableResponseList<User> getUserListMembers(long listId, long cursor) throws TwitterException;

Source Link

Document

Returns the members of the specified list.

Usage

From source file:com.dwdesign.tweetings.loader.UserListMembersLoader.java

License:Open Source License

@Override
public List<ParcelableUser> getUsers() throws TwitterException {
    final Twitter twitter = getTwitter();
    if (twitter == null)
        return null;
    final PagableResponseList<User> users;
    if (mListId > 0) {
        if (mUserListId <= 0) {
            mUserListId = mListId;//ww w  . j  a  v  a 2 s  . c o m
        }
        if (mOwnerId <= 0) {
            final UserList list = twitter.showUserList(mListId);
            final User owner = list != null ? list.getUser() : null;
            mOwnerId = owner != null ? owner.getId() : -1;
        }
        users = twitter.getUserListMembers(mListId, mCursor);
    } else {
        final UserList list = findUserList(twitter, mUserId, mScreenName, mListName);
        if (list == null)
            return null;
        if (mOwnerId <= 0) {
            final User owner = list.getUser();
            mOwnerId = owner != null ? owner.getId() : -1;
        }
        if (list != null && list.getId() > 0) {
            if (mUserListId <= 0) {
                mUserListId = list.getId();
            }
            users = twitter.getUserListMembers(list.getId(), mCursor);
        } else
            return null;
    }
    mNextCursor = users.getNextCursor();
    mPrevCursor = users.getPreviousCursor();
    final List<ParcelableUser> result = new ArrayList<ParcelableUser>();
    final int size = users.size();
    for (int i = 0; i < size; i++) {
        result.add(new ParcelableUser(users.get(i), mAccountId, (mCursor + 1) * 20 + i));
    }
    return result;
}

From source file:de.vanita5.twittnuker.loader.support.UserListMembersLoader.java

License:Open Source License

@Override
public PagableResponseList<User> getCursoredUsers(final Twitter twitter, final CursorPaging paging)
        throws TwitterException {
    if (twitter == null)
        return null;
    if (mListId > 0)
        return twitter.getUserListMembers(mListId, paging);
    else if (mUserId > 0)
        return twitter.getUserListMembers(mListName.replace(' ', '-'), mUserId, paging);
    else if (mScreenName != null)
        return twitter.getUserListMembers(mListName.replace(' ', '-'), mScreenName, paging);
    return null;//ww w.  ja  v a 2s .  com
}

From source file:org.getlantern.firetweet.loader.support.UserListMembersLoader.java

License:Open Source License

@Override
public PageableResponseList<User> getCursoredUsers(final Twitter twitter, final CursorPaging paging)
        throws TwitterException {
    if (twitter == null)
        return null;
    if (mListId > 0)
        return twitter.getUserListMembers(mListId, paging);
    else if (mUserId > 0)
        return twitter.getUserListMembers(mListName.replace(' ', '-'), mUserId, paging);
    else if (mScreenName != null)
        return twitter.getUserListMembers(mListName.replace(' ', '-'), mScreenName, paging);
    return null;//w  w  w .  j  a v  a 2 s .  c  om
}

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

License:Apache License

/**
 * Usage: java twitter4j.examples.list.GetUserListMembers [list owner screen name] [list id]
 *
 * @param args message//from   ww w  .  j a  v  a 2  s.c  om
 */
public static void main(String[] args) {
    if (args.length < 1) {
        System.out.println("Usage: java twitter4j.examples.list.GetUserListMembers [list id]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        long cursor = -1;
        PagableResponseList<User> usres;
        do {
            usres = twitter.getUserListMembers(Integer.parseInt(args[0]), cursor);
            for (User list : usres) {
                System.out.println("@" + list.getScreenName());
            }
        } while ((cursor = usres.getNextCursor()) != 0);
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get list members: " + te.getMessage());
        System.exit(-1);
    }
}