开发者

How to use paging for retrieving Google docs?

I wand to receive google docs info with paging using Java Client Library. My code:

private static final String URL_STRING = "https://docs.google.com/feeds/default/private/full/";

public List<DocumentListEntry> getAllDocs() throws Exception {
    URL feedUri = new URL(URL_STRING);
    DocumentQuery query = new DocumentQuery(feedUri);
    query.setMaxResults(2);
    query.setStartIndex(1);
    DocumentListFeed feed = client.getFeed(query, DocumentListFeed.class);
    return feed.getEntries();
}

And processing entries:

List<DocumentListEntry> docList = gDocumentsRetriever.getAllD开发者_开发知识库ocs();
for (DocumentListEntry entry : docList) {
    processEntry(oAuthToken, gDocumentsRetriever, entry);
}

I get two entries.But if I change

query.setStartIndex(1);

to

query.setStartIndex(3);

i get same two entries.


I found how this issue can be realized: http://code.google.com/apis/documents/docs/3.0/developers_guide_java.html#pagingThroughResults

For other services it realizes in the same way.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜