Google calendar api 谷歌日历,获取位置?

Google calendar api 谷歌日历,获取位置?,google-calendar-api,gdata-api,gdata,Google Calendar Api,Gdata Api,Gdata,我正在谷歌日历上使用JAVA和GDataAPI。 我正在尝试从公共日历中检索事件位置。以下是我的方法: private static void getCalendarEvents (CalendarService service, URL feedURL) throws IOException, ServiceException{ CalendarFeed resultFeed = service.getFeed(feedURL, CalendarFeed.c

我正在谷歌日历上使用JAVA和GDataAPI。 我正在尝试从公共日历中检索事件位置。以下是我的方法:

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());

    }
根据描述,该方法应该返回列表类型,但显然我没有得到它。 有人知道我为什么得到这个值吗?或者如何访问正确的返回值

请参见谷歌代码中CalendarEntry.class的代码:

非常感谢


好的,谢谢你!我在这里发布了无法检索事件日期的代码,请查看。 首先是我的getEventDates.class返回一个When对象的列表:

 private static List<When> getEventDates(CalendarEntry entry){
    return entry.getRepeatingExtension(When.class);

}
private静态列表getEventDates(CalendarEntry){
返回条目.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());

    }
for(int i=0;i
这是最糟糕的工作。。。也就是说,我在时间列表中得到了所有的“空”。 我只是想要xml中的内容,请给我一些提示。
非常感谢

对entry.getLocations()的调用返回一个可以迭代的Where对象列表

例如,可以使用每个Where实例的getValueString()方法获取包含位置文本描述的字符串


有关Where类的定义,请参见。

非常感谢,这很有效。而且我在获取活动日期方面仍然有问题。我已经更新了上面的问题,请看一看!谢谢,lotA CalendarEntry表示日历,因此没有日期。您试图获取的是CalendarEventEntry,它表示日历上的事件及其日期和时间。请检查位于的文档,不要向StackOverflow中的现有线程添加第二个问题,而是创建一个新的问题。
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());

    }