【问题标题】:Google Calendar return the result to ActivityGoogle 日历将结果返回给 Activity
【发布时间】:2015-11-27 07:14:01
【问题描述】:

是否可以使用 Google 日历将所选活动的结果发送到 Activity?
我正在使用startActivityForResult 从我的应用程序中打开谷歌日历,我想通过onActivityForResult 方法在我的应用程序中获取所选事件的详细信息。是否可以覆盖谷歌日历中的选择事件?

【问题讨论】:

    标签: android android-layout android-activity android-calendar


    【解决方案1】:

    您可以使用 Google Calendar API 查找和查看公共日历活动。 日历 API 允许您显示、创建和修改日历事件,以及使用许多其他与日历相关的对象,例如日历或访问控制。

    获取https://www.googleapis.com/calendar/v3/calendars/calendarId/events

     import com.google.api.services.calendar.Calendar;
     import com.google.api.services.calendar.model.Event;
    
     // ...
    
     // Initialize Calendar service with valid OAuth credentials
     Calendar service = new Calendar.Builder(httpTransport, jsonFactory, credentials)
    .setApplicationName("applicationName").build();
    
    // Retrieve an event
    Event event = service.events().get('primary', "eventId").execute();
    
    System.out.println(event.getSummary());
    

    我相信您可能会发现 Google Calendar API 真的很有用。

    参考链接https://developers.google.com/google-apps/calendar/v3/reference/events

    这可能对你有帮助。祝你好运

    【讨论】:

    • 我可以显示日历。但我需要的是,当用户从日历中选择事件时,如何导航回我的应用程序?
    • 你想先在谷歌日历上选择事件并在你的应用程序中获取价值
    • 我有一个困惑,您是在应用程序中打开日历,还是从谷歌日历中选择日期,请清楚
    • 我认为 @User7284 正在使用谷歌日历 API,它是正确的吗?
    • @ShubhankGupta 是的,我正在使用意图从我的应用程序中打开 Google 日历,日历显示所有事件,用户点击日历中的任何事件,系统应该导航回我的应用程序,我想在我的应用程序屏幕中显示事件详细信息。有可能吗?意图打开应用程序Intent intent = new Intent(Intent.ACTION_VIEW, builder.build()); startActivityForResult(intent, 2);
    猜你喜欢
    • 1970-01-01
    • 2016-05-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-11
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多