Android examples for Android OS:Calendar Event
add Attendee to Calendar Event
//package com.java2s; import android.content.ContentResolver; import android.content.ContentValues; import android.content.Context; import android.net.Uri; import android.provider.CalendarContract.Attendees; import android.util.Log; public class Main { static final String LOG = "CalendarUtil"; private static void addAttendee(Context ctx, long eventID, String email, String attendeeName) throws Exception { ContentResolver cr = ctx.getContentResolver(); ContentValues values = new ContentValues(); values.put(Attendees.ATTENDEE_NAME, attendeeName); values.put(Attendees.ATTENDEE_EMAIL, email); values.put(Attendees.ATTENDEE_RELATIONSHIP, Attendees.RELATIONSHIP_ATTENDEE); values.put(Attendees.ATTENDEE_TYPE, Attendees.TYPE_REQUIRED); values.put(Attendees.ATTENDEE_STATUS, Attendees.ATTENDEE_STATUS_INVITED); values.put(Attendees.EVENT_ID, eventID); Uri u = cr.insert(Attendees.CONTENT_URI, values); Log.i(LOG,//from ww w . j a v a2s. co m "attendee added ... " + attendeeName + "\n" + u.toString()); } }