Search in sources :

Example 26 with TwitterException

use of twitter4j.TwitterException in project twitter4j by yusuke.

the class UpdateUserList method main.

/**
     * Usage: java twitter4j.examples.list.UpdateUserList [list id] [new list name] [new description]
     *
     * @param args message
     */
public static void main(String[] args) {
    if (args.length < 3) {
        System.out.println("Usage: java twitter4j.examples.list.UpdateUserList [list id] [new list name] [new description]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.updateUserList(Integer.parseInt(args[0]), args[1], true, args[2]);
        System.out.println("Successfully updated list [" + args[0] + "].");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to update list: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 27 with TwitterException

use of twitter4j.TwitterException in project twitter4j by yusuke.

the class GetMutingUsersIDs method main.

/**
     * Usage: java twitter4j.examples.mute.GetMutingUsersIDs
     *
     * @param args message
     */
public static void main(String[] args) {
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        IDs ids = twitter.getMutesIDs(-1L);
        for (long id : ids.getIDs()) {
            System.out.println(id);
        }
        System.out.println("done.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get muting user ids: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) IDs(twitter4j.IDs) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 28 with TwitterException

use of twitter4j.TwitterException in project twitter4j by yusuke.

the class UpdateProfile method main.

/**
     * Usage: java twitter4j.examples.account.UpdateProfile [name] [url] [location] [description]
     *
     * @param args message
     */
public static void main(String[] args) {
    if (args.length < 4) {
        System.out.println("Usage: java twitter4j.examples.account.UpdateProfile [name] [url] [location] [description]");
        System.exit(-1);
    }
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        twitter.updateProfile(args[0], args[1], args[2], args[3]);
        System.out.println("Successfully updated profile.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to update profile: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 29 with TwitterException

use of twitter4j.TwitterException in project twitter4j by yusuke.

the class VerifyCredentials method main.

/**
     * Usage: java twitter4j.examples.account.VerifyCredentials
     *
     * @param args message
     */
public static void main(String[] args) {
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        User user = twitter.verifyCredentials();
        System.out.println("Successfully verified credentials of " + user.getScreenName());
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to verify credentials: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : User(twitter4j.User) Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Example 30 with TwitterException

use of twitter4j.TwitterException in project twitter4j by yusuke.

the class GetBlockingUsers method main.

/**
     * Usage: java twitter4j.examples.block.GetBlockingUsers
     *
     * @param args message
     */
public static void main(String[] args) {
    try {
        Twitter twitter = new TwitterFactory().getInstance();
        int page = 1;
        List<User> users;
        do {
            users = twitter.getBlocksList(page);
            for (User user : users) {
                System.out.println("@" + user.getScreenName());
            }
            page++;
        // this code ends up in an infinite loop due to the issue 1988
        // http://code.google.com/p/twitter-api/issues/detail?id=1988
        } while (users.size() > 0 && page <= 10);
        System.out.println("done.");
        System.exit(0);
    } catch (TwitterException te) {
        te.printStackTrace();
        System.out.println("Failed to get blocking users: " + te.getMessage());
        System.exit(-1);
    }
}
Also used : User(twitter4j.User) Twitter(twitter4j.Twitter) TwitterFactory(twitter4j.TwitterFactory) TwitterException(twitter4j.TwitterException)

Aggregations

TwitterException (twitter4j.TwitterException)88 Twitter (twitter4j.Twitter)69 TwitterFactory (twitter4j.TwitterFactory)54 Status (twitter4j.Status)19 Intent (android.content.Intent)9 User (twitter4j.User)8 ArrayList (java.util.ArrayList)7 File (java.io.File)6 DirectMessage (twitter4j.DirectMessage)6 IDs (twitter4j.IDs)6 Paging (twitter4j.Paging)6 Context (android.content.Context)4 AppSettings (com.klinker.android.twitter.settings.AppSettings)4 Date (java.util.Date)4 SavedSearch (twitter4j.SavedSearch)4 AccessToken (twitter4j.auth.AccessToken)4 MentionsDataSource (com.klinker.android.twitter.data.sq_lite.MentionsDataSource)3 IOException (java.io.IOException)3 UserList (twitter4j.UserList)3 RequestToken (twitter4j.auth.RequestToken)3