android-如何显示本地日历?
我正在使用新的日历API,我想在我的应用程序中创建一个本地日历,用户可以在其中添加与应用程序相关的自定义事件。。因此,我能够通过以下代码创建它:android-如何显示本地日历?,android,calendar,android-calendar,Android,Calendar,Android Calendar,我正在使用新的日历API,我想在我的应用程序中创建一个本地日历,用户可以在其中添加与应用程序相关的自定义事件。。因此,我能够通过以下代码创建它: /** Creates the values the new calendar will have */ private static ContentValues buildNewCalContentValues() { final ContentValues cv = new ContentValues();
/** Creates the values the new calendar will have */
private static ContentValues buildNewCalContentValues() {
final ContentValues cv = new ContentValues();
cv.put(Calendars.ACCOUNT_NAME, ACCOUNT_NAME);
cv.put(Calendars.ACCOUNT_TYPE, CalendarContract.ACCOUNT_TYPE_LOCAL);
cv.put(Calendars.NAME, CALENDAR_NAME);
cv.put(Calendars.CALENDAR_DISPLAY_NAME, CALENDAR_NAME);
cv.put(Calendars.CALENDAR_COLOR, 0xEA8561);
// user can only read the calendar
cv.put(Calendars.CALENDAR_ACCESS_LEVEL, Calendars.CAL_ACCESS_READ);
cv.put(Calendars.OWNER_ACCOUNT, ACCOUNT_NAME);
cv.put(Calendars.VISIBLE, 1);
cv.put(Calendars.SYNC_EVENTS, 1);
return cv;
}
//Create and insert new calendar into android database
public static void createCalendar(Context ctx) {
ContentResolver cr = ctx.getContentResolver();
final ContentValues cv = buildNewCalContentValues();
Uri calUri = buildCalUri();
// insert the calendar into the database
cr.insert(calUri, cv);
}
但问题是我不知道如何显示它,如何让用户与它交互。
有什么帮助吗?提前感谢: