使用日历意图,我可以指定日历ID吗?而不是当前打开最后使用日历的方法。
在这种情况下,我想使用日历意图,而不是使用内容解析器。
我尝试过使用
.putExtra(CalendarContract.Events.CALENDAR_ID, calendarId);
但这不适用于cal ID 6(我手机中确实存在)
private void createEventPrompt(String title, String location, String description, long startTimeMillis, long endTimeMillis) {
//Create event with prompts, see the following for the extra options:
//http://developer.android.com/guide/topics/providers/calendar-provider.html#intents
//Android Bug in 5.0.1 - Does not let you specify an end time
Intent intent = new Intent(Intent.ACTION_INSERT)
.setData(CalendarContract.Events.CONTENT_URI)
.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, startTimeMillis)
.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTimeMillis)
.putExtra(CalendarContract.Events.TITLE, title)
.putExtra(CalendarContract.Events.DESCRIPTION, description)
.putExtra(CalendarContract.Events.EVENT_LOCATION, location);
startActivity(intent);
//Last method called in application, so close loading dialog
exitEventAddingActivity();
}
谢谢!