Java examples for Social Media:Twitter
Create user list and delete user list
import twitter4j.*; import twitter4j.auth.AccessToken; public class ManageList { public static void main(String[] args) { Twitter twitter = new TwitterFactory().getInstance(); String consumerKey = "a"; String consumerSecret = "a"; String accessToken = "a"; String accessTokenSecret = "a"; twitter.setOAuthConsumer(consumerKey, consumerSecret); twitter.setOAuthAccessToken(new AccessToken(accessToken, accessTokenSecret));/*from w ww .j ava 2 s .c om*/ try { if (args.length == 1) { twitter.destroyUserList(Integer.parseInt(args[0])); } if (args.length == 2) { twitter.createUserList(args[0], true, args[1]); } PagableResponseList<UserList> lists = twitter.getUserLists( twitter.getScreenName(), -1l); for (UserList list : lists) { System.out.println(list.getName() + " - " + list.getDescription() + "(" + list.getId() + ")"); } } catch (TwitterException te) { System.out.println(te.getMessage()); } } }