I've posted this question 
here<http://stackoverflow.com/questions/7656343/cant-update-event-on-phones-calendar-from-code>without
 any luck.

I'm attempting to update a calendar's event on my phone from my code, but 
context.getContentResolver().update keeps returning 0, and of course there 
are no changes made to the event when I look at it in the Calendar app. I 
have android.permission.READ_CALENDAR and android.permission.WRITE_CALENDAR 
set in the manifest. 

I'm getting the event ID, start time, etc with 
context.getContentResolver().query, and I'm getting unique numbers like 431, 
4, 233, etc, so I'm presuming the event IDs I'm using are real. 

I understand the official way to do this is to go through Google's servers 
instead of using update(), but for my implementation it doesn't make sense 
to do it that way (or even in general, but I digress).

Am I doing something wrong, or am I trying to do something that Android 
simply isn't going to 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 with no replies Update Android Calendar 
Event<http://stackoverflow.com/questions/5636350/update-android-calendar-event>

Let me know if I can clarify anything; I would really appreciate any input 
you guys and gals could provide!

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

Reply via email to