Hello, I'm currently developing an Android app to pull events off of a
public calendar using the new 1.5 beta APIs. I can grab events just fine,
but for some reason every event returned has the 'when' field set to null.
The url for the calendar I'm testing against is here:
https://www.google.com/calendar/feeds/freeformsoftware%40gmail.com/public/basic
The code I'm running looks something like this:
Calendar now = Calendar.getInstance();
Date startDate = new Date();
startDate.setYear(now.get(Calendar.YEAR)-1900);
startDate.setMonth(now.get(Calendar.MONTH));
startDate.setDate(now.get(Calendar.DATE));
startDate.setHours(now.get(Calendar.HOUR));
startDate.setMinutes(now.get(Calendar.MINUTE));
startDate.setSeconds(now.get(Calendar.SECOND));
Date endDate = new Date();
endDate.setYear(startDate.getYear());
endDate.setMonth(startDate.getMonth());
endDate.setDate(startDate.getDate() + DAYS_IN_FUTURE);
endDate.setHours(startDate.getHours());
endDate.setMinutes(startDate.getMinutes());
endDate.setSeconds(startDate.getSeconds());
CustomCalendarURL customUrl = CustomCalendarURL.getUrl();
customUrl.startMin = new DateTime(startDate);
customUrl.startMax = new DateTime(endDate);
CalendarUrl url = new CalendarUrl(customUrl.build());
EventFeed feed = client.eventFeed().list().execute(url);
for(EventEntry entry : feed.getEntries()) {
if(entry.when != null) {
if(entry.when.startTime != null) {
e.setDate(entry.when.startTime.toString().substring(0, 10));
e.setTime(entry.when.startTime.toString().substring(11, 19));
System.out.println("When: " + entry.when.startTime);
}
}
events.add(e);
}
Is there something wrong with my code?
Also, there appears to be two dates listed for each event here;
https://www.google.com/calendar/feeds/freeformsoftware%40gmail.com/public/basic
one right under the heading, and another listed below next to the word
"When". I assume the first date listed is the creation date, and not the
actual event date, correct?
--
You received this message because you are subscribed to the Google
Groups "Google Calendar Data API" group.
To post to this group, send email to
[email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://code.google.com/apis/calendar/community/forum.html