You are here

setMaxItems

public void setMaxItems(int maxItems) sets the maximum number of items in the list.

Parameters

int maxItems
Sets the maximum number of items in the list.

Returns

void

Example


    DocumentFolderService dfs = session.getServiceRegistry()
        .getDocumentFolderService();
    
    ListingContext lc = new ListingContext();
    
    int skipCount = 0;
    lc.setMaxItems(10);
    lc.setSkipCount(skipCount);
    
    PagingResult<Node> results = dfs.getChildren(dfs.getRootFolder(), lc);
    Log.d(TAG, "hasMoreItems: " + results.hasMoreItems());
    Log.d(TAG, "getTotalItems: " + results.getTotalItems());
    Log.d(TAG, "getMaxItems: " + results.getMaxItems());
    Log.d(TAG, "isSortAscending: " + results.isSortAscending());
    
    listResults(results);
    // get remaining nodes 10 at a time
    while (results.hasMoreItems()) {
    
        skipCount += 10;
        lc.setSkipCount(skipCount);
        Log.d(TAG, "getSkipCount: " + results.getSkipCount());
 
        results = dfs.getChildren(dfs.getRootFolder(), lc);
        listResults(results);
    
    }