Reputation: 708
How do I get all the members of a list ?
I tried the following function.
int cursor=-1;
twitter.getUserListMembers(LIST_ID, cursor);
But it returns only 20 members. If I decrement or increment the value of cursor
, the results are same. The list contains more than 100 users.
Upvotes: 1
Views: 175
Reputation: 708
Set<String> members=new HashSet<String>();
long cursor = -1;
PagableResponseList<User> membes;
do {
membes = twitter.getUserListMembers(LIST_ID,cursor);
for (User mem : membes) {
members.add(mem.getScreenName());
}
} while ((cursor = membes.getNextCursor()) != 0);
Upvotes: 2