add Attendee To Event Calendar - Android Android OS

Android examples for Android OS:Calendar Event

Description

add Attendee To Event Calendar

Demo Code


//package com.java2s;

import android.content.ContentValues;
import android.content.Context;

import android.net.Uri;
import android.provider.CalendarContract;
import android.provider.CalendarContract.Attendees;

public class Main {
    public static Uri addAttendeeToEvent(Context ctx, Uri calendar,
            String name, String email) {
        long id = Long.parseLong(calendar.getLastPathSegment());
        ContentValues cv = new ContentValues();
        cv.put(Attendees.ATTENDEE_NAME, name);
        cv.put(Attendees.ATTENDEE_EMAIL, email);
        cv.put(Attendees.EVENT_ID, id);/* w  w w  .  jav a 2 s .  c  o m*/

        Uri newEvent = ctx.getContentResolver().insert(
                CalendarContract.Attendees.CONTENT_URI, cv);
        return newEvent;
    }
}

Related Tutorials