0
我想从日历中删除所有日历条目,但此代码并未删除没有条目。删除日历中的所有条目
的源代码:
ContentResolver cr = getContentResolver();
Uri CALENDAR_URI = Uri.parse("content://com.android.calendar/events");
int id = 2; // calendar ID
Uri uri = ContentUris.withAppendedId(CALENDAR_URI, id);
cr.delete(uri, null, null);
我试过这段代码:Uri eventsUri = Uri.parse(“content://com.android.calendar/events”); \t \t \t \t Uri eventUri = ContentUris.withAppendedId(eventsUri,2); (eventUri,null,null);但我不知道这个“2”是日历的id还是条目的id ContentUris.withAppendedId(eventsUri,>> 2 <<);我不知道这个“2”是否是日历的ID或条目ContentUris.withAppendedId(eventsUri,>> 2 <<);我不知道这个“2” – Husky 2011-04-26 18:47:52
事件条目的ID。您查询事件,然后使用事件ID上的withAppendedId对每个事件调用delete。 – EboMike 2011-04-26 19:31:23