Java 如何通过程序代码到达日历中的编辑事件?

Java 如何通过程序代码到达日历中的编辑事件?,java,android,calendar,Java,Android,Calendar,如何通过程序代码到达日历中的编辑事件? 任何帮助都将受到高度赞赏并提前表示感谢。 使用此意图,您可能会得到以下解决方案: Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("title", "Some title"); intent.putExtra("description", "Some description");

如何通过程序代码到达日历中的编辑事件? 任何帮助都将受到高度赞赏并提前表示感谢。

使用此意图,您可能会得到以下解决方案:

Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Some title");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime",  cal.getTimeInMillis());
intent.putExtra("endTime",  cal.getTimeInMillis()+60*60*1000);
startActivity(intent);

本教程介绍如何在Google Android应用程序中访问内部日历数据库:

由于代码必须是独立于版本的,我们不能对不同类型的手机和版本使用不同的代码。我们必须根据版本从日历数据库中获取Uri。指定的链接u版本无效,请参见[此][1][1]: