Example usage for twitter4j AsyncTwitter getUserTimeline

List of usage examples for twitter4j AsyncTwitter getUserTimeline

Introduction

In this page you can find the example usage for twitter4j AsyncTwitter getUserTimeline.

Prototype

void getUserTimeline(String screenName, Paging paging);

Source Link

Document

Returns the 20 most recent statuses posted from the authenticating user.

Usage

From source file:com.marpies.ane.twitter.functions.GetUserTimelineFunction.java

License:Apache License

@Override
public FREObject call(FREContext context, FREObject[] args) {
    super.call(context, args);

    int count = FREObjectUtils.getInt(args[0]);
    long sinceID = (args[1] == null) ? -1 : Long.valueOf(FREObjectUtils.getString(args[1]));
    long maxID = (args[2] == null) ? -1 : Long.valueOf(FREObjectUtils.getString(args[2]));
    mExcludeReplies = FREObjectUtils.getBoolean(args[3]);
    long userID = FREObjectUtils.getDouble(args[4]).longValue();
    String screenName = (args[5] == null) ? null : FREObjectUtils.getString(args[5]);
    mCallbackID = FREObjectUtils.getInt(args[6]);

    AsyncTwitter twitter = TwitterAPI.getAsyncInstance(TwitterAPI.getAccessToken());
    twitter.addListener(this);

    /* If user ID was not provided then use the one of currently logged in user */
    if (userID < 0) {
        userID = TwitterAPI.getLoggedInUser().getId();
    }/*from  w  w  w .j  a  va2  s . c  o  m*/

    Paging paging = getPaging(count, sinceID, maxID);
    if (paging != null) {
        if (screenName != null) {
            twitter.getUserTimeline(screenName, paging);
        } else {
            twitter.getUserTimeline(userID, paging);
        }
    } else {
        if (screenName != null) {
            twitter.getUserTimeline(screenName);
        } else {
            twitter.getUserTimeline(userID);
        }
    }

    return null;
}