Android problem deleting event in calender


Last Updated:

  1. kamiomar

    kamiomar Member This Topic's Starter

    Joined:
    Apr 27, 2010
    Messages:
    5
    Likes Received:
    0
    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:

    Code (Text):
    1. Uri calendars = Uri.parse("content://calendar/events");
    2.       try {
    3.                   String[] projection = new String[] { "_id" };
    4.                   Cursor managedCursor = contentResolver.get(calendars, projection, null, null,
    5.                               null);
    6.                   if (managedCursor != null) {
    7.                         if (managedCursor.moveToFirst()) {
    8.                               do {
    9.                                     String[] columns = managedCursor.getColumnNames();
    10.                                     for (int i = 0; i < columns.length; i++) {
    11. contentResolver.delete(Uri.withAppendedPath(calendars, "/" + managedCursor.getString(i)), null, null);
    12.                                     }
    13.                               } while (managedCursor.moveToNext());
    14.                         }
    15.                   }
    16.             } catch (Exception e) {
    17.                   e.printStackTrace();
    18.                   // TODO: handle exception
    19.             }
    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:
    [​IMG]
     

    Advertisement
  2. spfoo

    spfoo New Member

    Joined:
    Jan 10, 2011
    Messages:
    2
    Likes Received:
    0
    I'm having this problem as well with my implementation. Creating new events works fine, but deletion always fails. Did you manage to solve it?
     

Share This Page

Loading...