You don't say which feed type you are accessing for the target
Calendar, but this is one possible explanation for not finding the
time information.
Take a look here:
http://code.google.com/apis/gdata/calendar.html#Feeds
A "basic" feed would give the behavior you are seeing, but one of the
"full" feeds would not.
Hope this helps!
-- Kyle
On 8/19/06, picalo <markbwarner@xxxxxxxxxxxx> wrote:
>
> I am having a hard time getting the date of an event. From the code
> below the retrievedEntry.getPublished() method gives me the date that
> an event was "created" not the date it is on. All I want to do is do a
> search and when I find an entry just get the date is on. The
> retrievedEntry.getTimes() returns a length of 0. All entries have a
> startdatetime and enddatetime. Why is this returning a length of 0?
>
> Query myQuery = new Query(feedUrl);
>
> myQuery.setFullTextQuery("Tennis");
> Feed myResultsFeed = (Feed) myService.query(myQuery,
> Feed.class);
> Calendar calendar = Calendar.getInstance();
>
> if (myResultsFeed.getEntries().size() > 0) {
> Entry firstMatchEntry = (Entry)
> myResultsFeed.getEntries().get(0);
> URL entryUrl = new
> URL(firstMatchEntry.getSelfLink().getHref());
> EventEntry retrievedEntry = (EventEntry)
> myService.getEntry(
> entryUrl, EventEntry.class);
> //The published date is the date the entry was
> "created"
>
> System.out.println(retrievedEntry.getPublished().toString());
> List listofTimes = retrievedEntry.getTimes();
> System.out.println("is empty comes back true... " +
> listofTimes.isEmpty());
> String myEntryTitle =
> retrievedEntry.getTitle().getPlainText();
> System.out.println("the title found is..." +
> myEntryTitle);
> DateTime d;
> System.out.println("lenght of list is this is 0 " +
> listofTimes.size());
> for (Iterator iter = listofTimes.iterator();
> iter.hasNext();) {
> When element = (When) iter.next();
> d = element.getStartTime();
> Date dd = new Date(d.getValue());
> calendar.setTime(dd);
> System.out.println("Calendar" +
> calendar.getTime());
> }
> }
>
>
> >
>
|