Grab timelines from several users at once?



I’m currently using Twitter4J to grab the timeline from a single user:

    AsyncTwitterFactory factory = new AsyncTwitterFactory(;
    AsyncTwitter asyncTwitter = factory.getInstance();
    asyncTwitter.addListener(new TwitterAdapter() {

        public void gotUserTimeline(ResponseList<Status> statuses) {
            for (Status status : statuses) {
                Log.d("twitter", "twitter: " + status.getText() + status.getUser().getName());

        public void onException(TwitterException te, TwitterMethod method) {
            super.onException(te, method);


What I need to do is grab the timelines from several users at once. I could run the previous call several times for different users, but that seems like bad practice and im hoping theres another way. I’m currently using Twitter4J, but am open to switching to the Fabric kit or something else if its easier to do it with that.


I’ve tried this before and ran into some problems with rate limits: It’s relatively straight forward to create a thread pool and send off concurrent requests to getUserTimeline()… but that’s a bad way to do it because you’re making lots of concurrent calls the same endpoint, and the rate limit becomes very unpredictable.

What worked for me for a while was:
PriorityQueues: Making 1 call to the API endpoint at a time, but request 1 “page” for every user at a time, only request the next page after you’ve got the first page for everyone. (since_id & max_id parameters really help - Twitter4J sets those with the Paging object)

An even better way to do it: Make a list of the users, and use eg:
Works great if the set of users you’re interested in won’t drastically change.

If that fails, the streaming API with follow parameters is definitely the way to go:


Thanks, both the Twitter lists and streaming api solutions sound like they would work. Looking at Twitter4J, it looks like it has a filter() method that corresponds to the part of the streaming api you linked. The list of users doesnt really need to change, though i guess it would be a cool feature to have selectable users. Ill give these solutions a try.