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);
不幸的是,我不認爲在月視圖中強制使用日曆應用程序是完全可能的。以上將打開給定時間的日曆,但如果用戶在周視圖模式下設置了他的日曆應用程序,則您可以做的事情不多。我很想在最後一點被證明是錯誤的! :-)