1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > android点击按钮跳转日历 如何打开Android日历应用程序并跳转到指定的日期?

android点击按钮跳转日历 如何打开Android日历应用程序并跳转到指定的日期?

时间:2022-12-23 17:54:27

相关推荐

android点击按钮跳转日历 如何打开Android日历应用程序并跳转到指定的日期?

您可以使用

calendar view执行此操作…使用setDate(长日期)方法将日历上的日期设置为您想要的日期

您也可以通过向日历添加事件来完成此操作

创建日历的意图

Intent calIntent = new Intent(Intent.ACTION_INSERT);

calIntent.setData(CalendarContract.Events.CONTENT_URI);

startActivity(calIntent)

播种日历日期和时间

Intent calIntent = new Intent(Intent.ACTION_INSERT);

calIntent.setType("vnd.android.cursor.item/event");

calIntent.putExtra(Events.TITLE, "Title here");

calIntent.putExtra(Events.EVENT_LOCATION, "Location here");

calIntent.putExtra(Events.DESCRIPTION, "Description here");

GregorianCalendar calDate = new GregorianCalendar(, 7, 15);

calIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true);

calIntent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME,

calDate.getTimeInMillis());

calIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME,

calDate.getTimeInMillis());

startActivity(calIntent);

这方面的一个例子可以在here看到

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。