0

Helo,

I want to delete an calendar event.

With this code from https://developer.android.com/guide/topics/providers/calendar-provider.html#delete-event

    ContentResolver cr = this.c.getContentResolver();
    ContentValues values = new ContentValues();
    Uri deleteUri = null;
    deleteUri = ContentUris.withAppendedId(CalendarContract.Events.CONTENT_URI, eventID);
    int rows = this.c.getContentResolver().delete(deleteUri, null, null);
    System.out.println("Eventid: " + eventID + " Rows deleted: " + rows);

it doesn't work.

Why I get this issue?

With this line

    System.out.println("Eventid: " + eventID + " Rows deleted: " + rows);

I get

07-28 17:33:45.984 30895-30895/de.ubik.kalender I/System.out: Eventid: 5 Rows deleted: 0

I guess, the event id is right. So what's the problem? I don't know.

ubik
  • 17
  • 3
  • your eventID is 5? Thought eventIDs looked like this 3x8h6rlah9gabcdefg89ll5f70? – ReyAnthonyRenacia Jul 29 '17 at 19:14
  • Try using the solution provided in this [SO thread](https://stackoverflow.com/questions/5806174/delete-calendar-entries) and [this one](https://stackoverflow.com/questions/6924438/how-to-delete-specific-event-in-calendar). – ReyAnthonyRenacia Jul 29 '17 at 19:18
  • Solved, I have to use Event_ID from CalendarContract.Instances.EVENT_ID and not from CalendarContract.Events._ID – ubik Jul 30 '17 at 19:29

0 Answers0