0
Intent calIntent = new Intent(Intent.ACTION_VIEW);
calIntent.setData(CalendarContract.Events.CONTENT_URI);
startActivity(calIntent);
我在清单文件中添加了权限,但不起作用。Android。如何调用日历意图在月视图中显示的东西?
Intent calIntent = new Intent(Intent.ACTION_VIEW);
calIntent.setData(CalendarContract.Events.CONTENT_URI);
startActivity(calIntent);
我在清单文件中添加了权限,但不起作用。Android。如何调用日历意图在月视图中显示的东西?
你错过了几步(比如设置您要查看的时间,例如),看看在documentation,那我在这里复制以供参考:
// A date-time specified in milliseconds since the epoch.
long startMillis;
...
Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
builder.appendPath("time");
ContentUris.appendId(builder, startMillis);
Intent intent = new Intent(Intent.ACTION_VIEW)
.setData(builder.build());
startActivity(intent);
不幸的是,我不认为在月视图中强制使用日历应用程序是完全可能的。以上将打开给定时间的日历,但如果用户在周视图模式下设置了他的日历应用程序,则您可以做的事情不多。我很想在最后一点被证明是错误的! :-)