首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >在android中使用Google-API-Java-Client检索Google日历中的所有事件事件(位置、描述等)

在android中使用Google-API-Java-Client检索Google日历中的所有事件事件(位置、描述等)
EN

Stack Overflow用户
提问于 2011-07-07 16:58:23
回答 1查看 511关注 0票数 1

我一直在尝试使用android中的Google-API-Java-Client在Google日历中获取事件的详细信息,如位置详细信息、描述、开始时间和结束时间等。

我使用了以下示例代码

http://code.google.com/p/google-api-java-client/source/browse?repo=samples#hg%2Fcalendar-v2-atom-android-sample

EN

回答 1

Stack Overflow用户

发布于 2011-11-23 00:03:33

我只能在时间范围内回答你的问题。这是我在calendar-android-sample中引用的解决方案:

代码语言:javascript
复制
    List<EventEntry> events; //Don't forget to initialize
    //Get CalendarEntry from somewhere
    CalendarEntry calendar = getCalendar(); //this my function. Create your own.

    CalendarUrl eventUrl =
        new CalendarUrl(calendar.getEventFeedLink());
    // page through results
    while (true) {
      EventFeed eventFeed = client.eventFeed().list().execute(eventUrl);
      if (eventFeed.events != null) {
        events.addAll(eventFeed.events);
      }
      String nextLink = eventFeed.getNextLink();
      if (nextLink == null) {
        break;
      }
    }
    int numEvents = events.size();
    When[] times = new When[numEvents];
    for (int i = 0; i < numEvents; i++) {
      times[i] = events.get(i).when; //here you can get all events time. Manipulate as you wish.
    }
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6608127

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档