List of usage examples for twitter4j StatusAdapter StatusAdapter
StatusAdapter
From source file:org.nosceon.titanite.examples.TweetEventSource.java
License:Apache License
@Override protected void onSubscribe(String id) { if (stream == null) { stream = new TwitterStreamFactory().getInstance(); stream.addListener(new StatusAdapter() { @Override/*from w w w.j a va2 s .c om*/ public void onStatus(Status status) { GeoLocation location = status.getGeoLocation(); if (location != null) { send("{ \"lat\" : " + location.getLatitude() + ", \"lng\" : " + location.getLongitude() + " }"); } } }); stream.filter(new FilterQuery().locations(RANGE)); } }
From source file:twitter4j.examples.lambda.TwitterStreamLambda.java
License:Apache License
public static void oldTraditionalDullBoringImplementation(String... dummy) { // Twitter4J 4.0.3 or earlier TwitterStream stream = TwitterStreamFactory.getSingleton(); stream.addListener(new StatusAdapter() { @Override//from ww w. j a va2 s . com public void onStatus(Status status) { String.format("@%s %s", status.getUser().getScreenName(), status.getText()); } @Override public void onException(Exception ex) { ex.printStackTrace(); } }); stream.filter(new FilterQuery(new String[] { "twitter4j", "#twitter4j" })); }