Example usage for twitter4j AsyncTwitter getFollowersList

List of usage examples for twitter4j AsyncTwitter getFollowersList

Introduction

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

Prototype

void getFollowersList(long userId, long cursor);

Source Link

Document

Returns a cursored collection of user objects for users following the specified user.
At this time, results are ordered with the most recent following first — however, this ordering is subject to unannounced change and eventual consistency issues.

Usage

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

License:Apache License

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

    long cursor = FREObjectUtils.getDouble(args[0]).longValue();
    long userID = FREObjectUtils.getDouble(args[1]).longValue();
    String screenName = (args[2] == null) ? null : FREObjectUtils.getString(args[2]);
    mCallbackID = FREObjectUtils.getInt(args[3]);

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

    /* Query followers for screen name */
    if (screenName != null) {
        twitter.getFollowersList(screenName, cursor);
    }//from  w w  w  .j a  va2  s  . c  o m
    /* Or query for user ID */
    else {
        /* If user ID was not provided then use the one of currently logged in user */
        if (userID < 0) {
            userID = TwitterAPI.getLoggedInUser().getId();
        }
        twitter.getFollowersList(userID, cursor);
    }

    return null;
}