Java tutorial
/* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ package util; import twitter4j.Twitter; import twitter4j.TwitterFactory; import twitter4j.auth.AccessToken; import twitter4j.conf.ConfigurationBuilder; /** * * @author Nautile */ public class UtilConfig { public final static String CONSUMER_KEY = "5RD9n0U9gI5ZFRgQlEU7YsDt1"; public final static String CONSUMER_SECRET = "mWQ1q8otDS01cpuyB7r15OnMlvXmZslL4jLTco7e9W7peDmxVQ"; public final static String ACCESS_TOKEN = "788060666687000576-acPISuUABiLhqZyl8h5cB9Q7iykfdwO"; public final static String ACCESS_TOKEN_SECRET = "Xq3VcLyLe9hVysu4LEtwb6o8SMtubkwR1GFB3M5o83hOC"; private static Twitter twitter; public static Twitter getTwitterInstance() { if (twitter == null) { ConfigurationBuilder cb = new ConfigurationBuilder(); cb.setDebugEnabled(true).setOAuthConsumerKey(CONSUMER_KEY).setOAuthConsumerSecret(CONSUMER_SECRET) .setOAuthAccessToken(ACCESS_TOKEN).setOAuthAccessTokenSecret(ACCESS_TOKEN_SECRET); TwitterFactory tf = new TwitterFactory(cb.build()); twitter = tf.getInstance(); } return twitter; } }