Hi!

I'm currently writing a class to access the android calendar,
retrieving and inserting new events does already work but I'm having
trouble to update existing events. With the the methods I already have
I could check the ID of the calendar I want to work with, which is 5.
I also could find out the ID of an event in that calendar which is 87.
I'm trying to update that event with this code (well actually it is a
bit different but I've shorten it a bit so it's not so much code to
read for you):

if(Build.VERSION.RELEASE.contains("2.2")) {
                contentProvider = "com.android.calendar";
            } else {
                contentProvider = "calendar";
            }

eventsUri = Uri.parse(String.format("content://%s/
events",contentProvider));
Uri updateEventUri = Uri.withAppendedPath(eventsUri,
String.valueOf(87));

ContentValues event = new ContentValues();
event.put("calendar_id", 5);
event.put("title", "Modified Title");

mContext.getContentResolver().update(updateEventUri, event, null,
null);  // mContext is the context of the activity which is using my
helper class.


(Of course the id's aren't hard coded in the original code. ;-) )

The problem is, after that update, the event I wanted to change isn't
changed at all. I'm not recieving any error messages that the Uri is
wrong or something like that, so I have no idea why it isn't working.
I tried different calendar IDs and different event IDs but there was
no effect either. In the logs I've created the resulting Uri is
"content://com.android.calendar/events/87" which looks fine to me
since I'm running it on froyo.

I hope somebody has some advice for me. Sincerely,
Bender

-- 
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