Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 11 years ago.
Improve this questionhow to delete all event in code of my calendar everything i try dose not work for me.
So i will appreciate if someone can give me a complete solution on How to Delete all my event from my calendar
Thanks for Helping!!!!
u can't delete a all events at a time.u can delete one by one. first u retrieve the event id
Cursor cursor=getContentResolver().query(Uri.parse(""content://calendar/events"), null, null, null, null);
cursor.moveToFirst();
// fetching calendars id
if(cursor.getcount>0)
{
CId = new int[cursor.getCount()];
int i=0;
while(!cursor.isAfterLast())
{
CId[i] = cursor.getInt(cursor.getColumnIndex("_id"));
i++;
cursor.moveToNext();
}
delete a calender event
for (int i = 0; i < CNames.length; i++)
{
Uri CALENDAR_URI = Uri.parse("content://calendar/events");
Uri uri = ContentUris.withAppendedId(CALENDAR_URI,Cid[i]);
getContentResolver().delete(uri, null, null);
}
Settings->Applications->Manage Applications>Calendar->Clear Data
If not try to find "Calendar Storage" app in the list right below the "Calendar" entry and clear it's data.
精彩评论