Example usage for twitter4j Query getCount

List of usage examples for twitter4j Query getCount

Introduction

In this page you can find the example usage for twitter4j Query getCount.

Prototype

public int getCount() 

Source Link

Document

Returns the number of tweets to return per page, up to a max of 100

Usage

From source file:com.github.moko256.mastodon.MTRangeConverter.java

License:Apache License

public static Range convert(Query query) {
    return new Range(convertLong(query.getMaxId()), convertLong(query.getSinceId()),
            (query.getCount() == -1) ? 0 : query.getCount());
}

From source file:twitterAPI.Twitter_testing.java

public void getSearchTweets(String regex) {
    //String queryStr = "@RobotGrrl";
    try {/*from  www.ja  v a 2s .  co  m*/
        //Twitter twitter = TwitterFactory.getSingleton();
        Query query = new Query(regex);
        query.count(100);
        System.out.println(query.getCount());

        QueryResult result = twitter.search(query);
        for (Status status : result.getTweets()) {

            searchHandler sh = new searchHandler();
            sh.nama = status.getUser().getScreenName();
            sh.tweet = status.getText();

            StringBuffer address = new StringBuffer();
            address.append("http://twitter.com/#!/");
            address.append(sh.nama);
            address.append("/status/");
            address.append(status.getId());

            String theAddressYouWant = address.toString();
            sh.URL = theAddressYouWant;
            shholder.add(sh);
            //System.out.println(theAddressYouWant); ini buat test bener apa ga url nya , udah bener
            //System.out.println("@" + sh.nama + ":" + sh.tweet);
        }
    } catch (TwitterException e) {
        System.out.println("Search tweets: " + e);
    }
}