Twitter4j. Querying and filtering messages #hashtag

I am trying to integrate twitter (using Twitter4j) into my Android app and I have few problems / questions:

I want to get tweets with a specific #hashtag, for example # sxbsw2011. Here is the code I'm currently using:

Query query = new Query("#sxsw2011 since:2010-11-21");  
QueryResult result = twitter.search(query);  
for (Tweet tweet : result.getTweets())  
{  
     Log.d(TAG, tweet.getId() + " " + tweet.getFromUser() + " : " + tweet.getText());  
}

I want to put the result in one of my views on my layout, which serves as a conversation screen. My problem is that I want to run this request every few, 4 or 5 seconds to get new comments. But with every search, I get all the tweets that are created today. Then I will need to use the tweet id to exclude those that are already shown in the conversation window. To me this seems wrong. Is there any other way to search for tweets and specify a time span like a few minutes? Is there a better way to do what I want? I tried to use StatusListener, but I have a problem trying to figure out how to use getFilterStream().

What are Twitter restrictions. How many times my application (it will run on multiple user devices) can request the result?

101010 , .

+5

All Articles