开发者

Android Calendar manipulation question [closed]

开发者 https://www.devze.com 2023-03-14 11:47 出处:网络
Clo开发者_JAVA百科sed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Clo开发者_JAVA百科sed. This question is off-topic. It is not currently accepting answers.

Want to improve this question? Update the question so it's on-topic for Stack Overflow.

Closed 11 years ago.

Improve this question

how 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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号