Skip to content

Instantly share code, notes, and snippets.

@abh1nav
Created December 15, 2012 21:12
Show Gist options
  • Save abh1nav/4299262 to your computer and use it in GitHub Desktop.
Save abh1nav/4299262 to your computer and use it in GitHub Desktop.
StatusListener listener = new StatusListener() {
@Override
public void onStatus(Status status) {
// do stuff with tweet
}
@Override
public void onDeletionNotice(StatusDeletionNotice sdn) { }
@Override
public void onTrackLimitationNotice(int i) { }
@Override
public void onScrubGeo(long l, long l1) { }
@Override
public void onException(Exception e) { }
};
TwitterStreamFactory factory = new TwitterStreamFactory(new ConfigurationBuilder().setUser(username).setPassword(pwd).build());
TwiterStream twitterStream = factory.getInstance();
twitterStream.addListener(listener);
twitterStream.sample();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment