I am trying to add calendar events with my applicatiom. Event gets saved 
successfully. However when i try to edit that event in Calendar. I get 
Force Close error.

           String calId = "";
            Cursor userCursor 
=getContentResolver().query(Uri.parse(content://com.android.calendar/calendars),null,
 
null, null, null);
            if(userCursor.getCount() > 0){
                userCursor.moveToFirst();
                calId = 
userCursor.getString(userCursor.getColumnIndex("_id"));
                }
            ContentValues event = new ContentValues();
            event.put("title", "title");
            event.put("description", "description");
            event.put("eventLocation", "Event Location"); 
            event.put("allDay", 0);
            event.put("hasAlarm",0);
            event.put("calendar_id",calId);
            Calendar mCalendar = Calendar.getInstance();
            mCalendar.set(2012, 2, 27,7,00,00);
            long start = mCalendar.getTimeInMillis();
            mCalendar.set(2012, 2, 27,8,00,00);
            long end = mCalendar.getTimeInMillis();
            event.put("dtstart",  start);
            event.put("dtend", end);


            Uri newEvent = Uri.parse(content://com.android.calendar/events);
            getContentResolver().insert(newEvent, event);
            ContentValues values = new ContentValues();
            userCursor.close();

But when I change event.put("allDay", 0); to event.put("allDay", 1);
Event gets saved successfully and gets edited successfully.

How do I fix it?

Using 2.3.5 device. Appreciate any help. thanks.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to