List of usage examples for twitter4j PagableResponseList hasPrevious
@Override
boolean hasPrevious();
From source file:com.marpies.ane.twitter.utils.UserUtils.java
License:Apache License
/** * Creates JSON from given response list and dispatches generic event. * Helper method for queries like getFollowers and getFriends. * @param users/*from w w w . j a va2 s .c om*/ * @param callbackID */ public static void dispatchUsers(PagableResponseList<User> users, final int callbackID) { try { AIR.log("Got response with " + users.size() + " users"); /* Create array of JSON users */ JSONArray usersJSON = new JSONArray(); for (User user : users) { /* Create JSON for each user and put it to the array */ JSONObject userJSON = getJSON(user); usersJSON.put(userJSON.toString()); } JSONObject result = new JSONObject(); result.put("users", usersJSON); if (users.hasNext()) { result.put("nextCursor", users.getNextCursor()); } if (users.hasPrevious()) { result.put("previousCursor", users.getPreviousCursor()); } result.put("listenerID", callbackID); AIR.dispatchEvent(AIRTwitterEvent.USERS_QUERY_SUCCESS, result.toString()); } catch (JSONException e) { AIR.dispatchEvent(AIRTwitterEvent.USERS_QUERY_ERROR, StringUtils.getEventErrorJSON(callbackID, "Error creating result JSON: " + e.getMessage())); } }