List of usage examples for twitter4j AsyncTwitter setOAuthConsumer
void setOAuthConsumer(String consumerKey, String consumerSecret);
From source file:org.primefaces.examples.service.TwitterAPIService.java
License:Apache License
public List<Status> asyncSearch(String query) { TwitterListener listener = new TwitterAdapter() { @Override//from w ww . jav a 2s . co m public void searched(QueryResult queryResult) { asyncTweets = queryResult.getTweets(); } @Override public void onException(TwitterException e, TwitterMethod method) { logger.severe(e.getMessage()); } }; AsyncTwitter twitter = new AsyncTwitterFactory().getInstance(); twitter.setOAuthConsumer(twitter_consumer_key, twitter_consumer_secret); twitter.setOAuthAccessToken(new AccessToken(access_token, access_token_secret)); twitter.addListener(listener); Query q = new Query(query); twitter.search(q); return asyncTweets; }