Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Android日历提供程序-使用intent创建具有特定日历ID的日历提示_Java_Android_Events_Android Intent_Calendar - Fatal编程技术网

Java Android日历提供程序-使用intent创建具有特定日历ID的日历提示

Java Android日历提供程序-使用intent创建具有特定日历ID的日历提示,java,android,events,android-intent,calendar,Java,Android,Events,Android Intent,Calendar,使用日历意图,我是否可以指定日历ID?而不是当前的方法,它打开了最后使用的日历 在这个场景中,我希望使用日历意图,而不是使用contentresolver 我试过使用 .putExtra(CalendarContract.Events.CALENDAR_ID, calendarId); 但这对cal ID 6(我的手机中确实存在)不起作用 谢谢 你到底想做什么?打开日历,在特定日历中填入数据。目前,它打开了上次使用的日历。我也有同样的问题,你找到解决方案了吗?没有,我找不到解决方案,就这样离开

使用日历意图,我是否可以指定日历ID?而不是当前的方法,它打开了最后使用的日历

在这个场景中,我希望使用日历意图,而不是使用contentresolver

我试过使用

.putExtra(CalendarContract.Events.CALENDAR_ID, calendarId);
但这对cal ID 6(我的手机中确实存在)不起作用


谢谢

你到底想做什么?打开日历,在特定日历中填入数据。目前,它打开了上次使用的日历。我也有同样的问题,你找到解决方案了吗?没有,我找不到解决方案,就这样离开了。如果您确实发现了,请发布contentResolver是否可行?
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();
}