Read twitter trends - Java Social Media

Java examples for Social Media:Twitter

Description

Read twitter trends

Demo Code

import twitter4j.*;

public class ShowTrends {
    public static void main(String[] args) {
        Twitter twitter = new TwitterFactory().getInstance();

        try {/*from w w w.ja  v  a2  s  .co m*/
            Trends trends = twitter.getTrends();
            for (Trend trend : trends.getTrends()) {
                System.out
                        .println(trend.getName() + " - " + trend.getUrl());
            }
            System.exit(0);
        } catch (TwitterException te) {
            te.printStackTrace();
            System.out
                    .println(te.getMessage());
            System.exit(-1);
        }
    }
}

Related Tutorials