【发布时间】:2011-11-12 01:43:08
【问题描述】:
我在 Google 日历上使用 JAVA 和 gdata api。 我正在尝试从公共日历中检索事件位置。这是我的方法:
private static void getCalendarEvents (CalendarService service, URL feedURL)
throws IOException, ServiceException{
CalendarFeed resultFeed = service.getFeed(feedURL, CalendarFeed.class);
for(int i = 0; i < resultFeed.getEntries().size(); i++){
CalendarEntry entry = resultFeed.getEntries().get(i);
System.out.println("\t" + entry.getLocations());
}
在我的控制台中,对于“entry.getLocation()”部分,我不断得到如下输出:
[com.google.gdata.data.extensions.Where@1f3785d3]
[com.google.gdata.data.extensions.Where@1f3785d3]
....
根据描述,该方法应该返回一个 List 类型,但显然我没有得到它。 任何人都知道为什么我得到这个值?或者我怎样才能获得正确的返回值?
另请参阅 Google 代码上的 CalendarEntry.class 代码: http://www.google.com/codesearch#EOYaOg_yTgg/trunk/java/src/com/google/gdata/data/calendar/CalendarEntry.java
非常感谢。
好的,谢谢!我在这里发布了无法检索事件日期的代码,请看一下。 首先是我的 getEventDates.class 返回一个 When 对象列表:
private static List<When> getEventDates(CalendarEntry entry){
return entry.getRepeatingExtension(When.class);
}
我在下面这样称呼它:
for(int i = 0; i < resultFeed.getEntries().size(); i++){
CalendarEntry entry = resultFeed.getEntries().get(i);
List<When> timeList = getEventDates(entry);
System.out.println("\t" + i+". "+entry.getTitle().getPlainText() + "\t" + timeList.get(0).getValueString());
}
这完成了...这意味着,我在 timeList 中得到了所有“null”。 我只想拥有xml中的内容,请给我一些提示。 非常感谢!!
【问题讨论】:
标签: google-calendar-api gdata-api gdata