从我的android应用程序在google日历中添加事件

从我的android应用程序在google日历中添加事件,android,google-calendar-api,Android,Google Calendar Api,你好,我是android的初学者。 我想从我的android应用程序在google日历中添加一个事件。 请帮我完成源代码。我已经看过了,但还没有找到一个包含完整源代码的解决方案。您可以使用ContentValues,比如local db String eventUriString = "content://com.android.calendar/events"; ContentResolver cr = this.getContentResolver(); ContentVal

你好,我是android的初学者。 我想从我的android应用程序在google日历中添加一个事件。
请帮我完成源代码。我已经看过了,但还没有找到一个包含完整源代码的解决方案。

您可以使用ContentValues,比如local db

String eventUriString = "content://com.android.calendar/events";
    ContentResolver cr = this.getContentResolver();
    ContentValues values = new ContentValues();

  values.put(CalendarContract.Reminders.CALENDAR_ID, 1);
        values.put(CalendarContract.Reminders.TITLE, "YOUR_TITLE");
        values.put(CalendarContract.Reminders.DTSTART, TIMES IN MILLISECOND);


        values.put(CalendarContract.Reminders.DESCRIPTION,YOUR_TEXT);

        values.put(CalendarContract.Reminders.DTEND,  TIMES IN MILLISECOND);
        values.put(CalendarContract.Reminders.HAS_ALARM, true);


        values.put(CalendarContract.Reminders.EVENT_TIMEZONE, TimeZone.getDefault().getID());

 Uri uriEvents = cr.insert(CalendarContract.Events.CONTENT_URI, values);
 eventID = Long.parseLong(uriEvents.getLastPathSegment());

看起来你想让我们为你写些代码。虽然许多用户愿意为陷入困境的程序员编写代码,但他们通常只在海报已经试图自己解决问题时才提供帮助。演示这项工作的一个好方法是包括您迄今为止编写的代码、示例输入(如果有)、预期输出和实际获得的输出(控制台输出、回溯等)。你提供的细节越多,你可能得到的答案就越多。检查和。