Android examples for Android OS:Calendar Contract
create an iCalendar Attendee with properties from Calendar Model attendee
import android.content.ContentResolver; import android.content.Context; import android.net.Uri; import android.provider.CalendarContract; import com.android.calendar.CalendarEventModel; import java.io.*; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Calendar; import java.util.Random; import java.util.TimeZone; public class Main{ /**/*from www . j ava2s .c o m*/ * create an iCal Attendee with properties from Calendar Model attendee * * @param attendee * @param event */ public static void addAttendeeToEvent( CalendarEventModel.Attendee attendee, VEvent event) { if (attendee == null || event == null) return; Attendee vAttendee = new Attendee(); vAttendee.addProperty(Attendee.CN, attendee.mName); String participationStatus; switch (attendee.mStatus) { case CalendarContract.Attendees.ATTENDEE_STATUS_ACCEPTED: participationStatus = "ACCEPTED"; break; case CalendarContract.Attendees.ATTENDEE_STATUS_DECLINED: participationStatus = "DECLINED"; break; case CalendarContract.Attendees.ATTENDEE_STATUS_TENTATIVE: participationStatus = "TENTATIVE"; break; case CalendarContract.Attendees.ATTENDEE_STATUS_NONE: default: participationStatus = "NEEDS-ACTION"; break; } vAttendee.addProperty(Attendee.PARTSTAT, participationStatus); vAttendee.mEmail = attendee.mEmail; event.addAttendee(vAttendee); } }