Reputation: 758
I am using below mentioned code to retrieve all the events from all the calendars saved in the android's native calendar application. Now if I delete certain event from the native calendar, still my code fetches and shows that event. How can this be possible. Does it set some delete flag instead of actually deleting the event.
Cursor cursor = cr.query(Uri.parse("content://com.android.calendar/events"),
projection, selection, selectionArgs, null);
Upvotes: 2
Views: 1489
Reputation: 809
Please check whether the 'DELETED' flag is set.
or you can also try including the following in SELECTION
AND (deleted != 1)
so the selection string becomes,
String selection = "( ("+ "title" + " LIKE '"+name+"') AND ( deleted != 1 ) )";
Occasionally, the CalendarDB takes sometime for the events to be removed. But the 'deleted' COLUMN will be marked as '1' indicating that they will be deleted soon. The reason for the delay maybe the calendar is waiting to be synced
p.s: Try using this tool -- http://www.cellobject.net/Tools/CellObjectSQLiteXMLBrowser.aspx to visualize the Calendar DB. Please check for the 'deleted' and 'dirty' columns in the db
Upvotes: 7