public static void insertEventWithName(Context ctx, long id, String eventName, String descriptionEvent, Calendar beginTime) {
intent.putExtra(Events.CALENDAR_ID, (int) id);
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setData(Events.CONTENT_URI);
intent.putExtra(Events.TITLE, eventName);
intent.putExtra(Events.DESCRIPTION, descriptionEvent);
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,beginTime.getTimeInMillis());
intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE);
intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY);
ctx.startActivity(intent);
}
为了插入事件,我使用此代码,但始终设置为 last used calendar 。我想用我的身份证查看日历