1. Check out our app, Forums for Android! Download and leave feedback here!

Android problem deleting event in calender

Discussion in 'Application Development' started by kamiomar, Apr 27, 2010.

  1. kamiomar

    kamiomar Member
    Thread Starter
    5

    Apr 27, 2010
    5
    0
    5
    Software Eng.
    Pakistan Karachi
    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
    5

    Jan 10, 2011
    2
    0
    5
    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...