Example usage for com.google.gwt.gdata.client.gbase MediaFeedCallback MediaFeedCallback

List of usage examples for com.google.gwt.gdata.client.gbase MediaFeedCallback MediaFeedCallback

Introduction

In this page you can find the example usage for com.google.gwt.gdata.client.gbase MediaFeedCallback MediaFeedCallback.

Prototype

MediaFeedCallback

Source Link

Usage

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

License:Apache License

/**
 * Retrieve the media feed using the Google Base service and
 * the media feed uri for a given item. In GData all get, insert, update
 * and delete methods always receive a callback defining success
 * and failure handlers.//w  ww  . ja  v  a 2s.c o m
 * Here, the failure handler displays an error message while the
 * success handler calls showData to display the media entries.
 * 
 * @param itemsEntryUri The uri of the items entry for which to
 * retrieve the media feed
 */
private void getMedia(String itemsEntryUri) {
    showStatus("Loading media feed...", false);
    String mediaFeedUri = itemsEntryUri + "/media/";
    service.getMediaFeed(mediaFeedUri, new MediaFeedCallback() {
        public void onFailure(CallErrorException caught) {
            showStatus("An error occurred while retrieving the media feed: " + caught.getMessage(), true);
        }

        public void onSuccess(MediaFeed result) {
            MediaEntry[] entries = result.getEntries();
            if (entries.length == 0) {
                showStatus("No media found.", false);
            } else {
                showData(entries);
            }
        }
    });
}