I am trying to update a calendar event on my phone from my code, but context.getContentResolver (). update continues to return 0, and of course, no changes made to the event when I look at it in the application calendar.
I get the event id, start time, etc. with the request context.getContentResolver (). I get unique numbers, for example 431, 4, 233, etc., so I assume that the event IDs, m, are real.
I understand that the official way to do this is to go through the Google servers instead of using update (), but for my implementation it makes no sense to do it this way (or even in general, but I'm distracted).
Am I doing something wrong, or am I trying to do something that Android just won't allow?
Uri updateEventUri = ContentUris.withAppendedId(Uri.parse("content://com.android.calendar/events"), id); ContentValues cv = new ContentValues(); begin.set(Calendar.HOUR_OF_DAY, arg0.getCurrentHour()); //begin is a java.util.Calendar object begin.set(Calendar.MINUTE, arg0.getCurrentMinute()); //cv.put("_id", id); //cv.put("title", "yeahyeahyeah!"); cv.put("dtstart", begin.getTimeInMillis()); int updatedrowcount = context.getContentResolver().update(updateEventUri, cv, null, null); System.out.println("updated "+updatedrowcount+" rows with id "+id);
A related question was posted here unanswered https://stackoverflow.com/questions/5636350/update-android-calendar-event
Let me know if I can clarify anything; I would really appreciate any materials that the guys and dolls could provide you!