There is problem deleting event in a calender
I created events manually for the following days.
Monday 12 2010 Sunday 18 2010
I have delete events from the code.
Events Deletion Code:
After running the code Green mark still on the calendar which shows event but these events already deleted when u click on these event it says calender not found. I have attached the screen shot below:
I created events manually for the following days.
Monday 12 2010 Sunday 18 2010
I have delete events from the code.
Events Deletion Code:
Code:
Uri calendars = Uri.parse("content://calendar/events");
try {
String[] projection = new String[] { "_id" };
Cursor managedCursor = contentResolver.get(calendars, projection, null, null,
null);
if (managedCursor != null) {
if (managedCursor.moveToFirst()) {
do {
String[] columns = managedCursor.getColumnNames();
for (int i = 0; i < columns.length; i++) {
contentResolver.delete(Uri.withAppendedPath(calendars, "/" + managedCursor.getString(i)), null, null);
}
} while (managedCursor.moveToNext());
}
}
} catch (Exception e) {
e.printStackTrace();
// TODO: handle exception
}
After running the code Green mark still on the calendar which shows event but these events already deleted when u click on these event it says calender not found. I have attached the screen shot below: