3 messages in com.googlegroups.google-calendar-help-dataapiRe: getSummary is null| From | Sent On | Attachments |
|---|---|---|
| Darren Hinderer | 16 May 2006 21:48 | |
| Kyle Marvin | 19 May 2006 14:15 | |
| Darren Hinderer | 19 May 2006 15:39 |
| Subject: | Re: getSummary is null![]() |
|---|---|
| From: | Kyle Marvin (kmar...@google.com) |
| Date: | 05/19/2006 02:15:26 PM |
| List: | com.googlegroups.google-calendar-help-dataapi |
Hi Darren,
If all you want is a textual summary of the event information, you might choose the 'basic' feed projection instead (replace 'full' with 'basic' in the URL below). It will contain a generated content element that has the time, location, and description.
To access this content, the following code should work:
TextContent entryContent = (TextConstruct)searchEntry.getContent(); switch(entryContent.getContent().getType()) { case TextConstruct.Type.TEXT: PlainTextConstruct ptc = (PlainTextConstruct)entry.getContent(); // access plain text content break; case TextConstruct.Type.HTML: HtmlTextConstrut html = (HtmlTextConstruct)entry.getContent(); // access html content break; case TextConstruct.Type.XHTML: XhtmlTextConstruct xhtml = (XhtmlTextConstruct)entry.geContent(); // access content as html break; }
I believe that for the current implementation of Calendar basic feeds, you'll always fall into the Type.TEXT case, the above code just demonstrates how to handle all the various textual content types that Atom can support.
For completeness, the 'full' projection which you were using will include the various event attributes (location, time, etc) as XML elements within the entry. The EventEntry class provides convenience APIs for accessing this information. You can get an EventEntry from a 'regular' Entry via:
Entry entry = ... EventEntry eventEntry = new EventEntry(entry);
You can find more information about the various types of Calendar feeds and their content models here:
http://code.google.com/apis/gdata/calendar.html#Feeds
A detailed description of the 'full' event format can be found here:
http://code.google.com/apis/gdata/common-elements.html#gdEventKind
The Javadoc for EventEntry class might also be helpful. It can be found here:
http://code.google.com/apis/gdata/javadoc/com/google/gdata/data/extensions/EventEntry.html
I hope this helps.
-- Kyle
On 5/16/06, Darren Hinderer <hind...@gmail.com> wrote:
postUrl= new URL("http://www.google.com/calendar/feeds/"+email+/private/full");
Feed resultFeed = (Feed) service.query(myQuery, Feed.class); for(int i=0;i<resultFeed.getEntries().size();i++) { Entry searchEntry = (Entry)resultFeed.getEntries().get(i); System.out.println(searchEntry.getTitle().getPlainText()); System.out.println(searchEntry.getSummary().getPlainText()); }
Why does the getSummary result in a null pointer exception? The title prints out fine for each event and there is actually a description for each event.
I assume this is what is supposed to retrieve the description. After this failed, I tried using searchEntry.getContent but then became even more confused.
Or is the problem with my url? Why don't we have more API examples??? gah!




