Example usage for com.google.gwt.gdata.client.contacts ContactQuery setMaxResults

List of usage examples for com.google.gwt.gdata.client.contacts ContactQuery setMaxResults

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.contacts ContactQuery setMaxResults.

Prototype

public final native void setMaxResults(double maxResults) ;

Source Link

Document

Sets the maximum number of results to be retrieved.

Usage

From source file:com.google.gwt.gdata.sample.hellogdata.client.ContactsRetrieveContactsDemo.java

License:Apache License

/**
 * Retrieves a contacts feed using a Query object.
 * In GData, feed URIs can contain query string parameters. The
 * GData query objects aid in building parameterized feed URIs.
 * Upon successfully receiving the contacts feed, the contact entries
 * are displayed to the user via the showData method.
 * The MaxResults parameter is used to limit the number of entries
 * returned./*from   w  ww . j  a  v  a 2s  .  c o m*/
 * 
 * @param contactsFeedUri The contacts feed uri.
 */
private void queryContacts(String contactsFeedUri) {
    showStatus("Loading contacts feed...", false);
    ContactQuery query = ContactQuery.newInstance(contactsFeedUri);
    query.setMaxResults(50);
    service.getContactFeed(query, new ContactFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the Contacts feed: " + caught.getMessage(), true);
        }

        public void onSuccess(ContactFeed result) {
            ContactEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("You have no Contacts.", false);
            } else {
                showData(entries);
            }
        }
    });
}