4

How to pass the mail id of the calendar that to be synchronized into the create event through email? I have a spinner that shows the list of accounts to be synchronized as below picture. Now, as usual passing title,description to create event in calendar application, i use following code.

ContentValues values = new ContentValues();
    values.put("calendar_id", 1);
    values.put("title", title1);
    values.put("allDay", 0);
    values.put("dtstart", settime);
    values.put("dtend", cal.getTimeInMillis()+60*60*1000); 
    values.put("description", desc1);
    values.put("???????", mail_id);
    values.put("???????", participant_mail_id);
    values.put("visibility", 0);
    values.put("hasAlarm", 1);
    event = cr.insert(EVENTS_URI, values);

What should i use to pass the key to insert email id and participant id? Any Help is really appreciated. My screen shot goes below.

enter image description here

Pattabi Raman
  • 5,814
  • 10
  • 39
  • 60

1 Answers1

1

How to pass the mail id of the calendar that to be synchronized

The event is linked to a calendar by the "calendar_id". To get the "calendar_id" you should query for all the user's calendars and then search results for name in which you are interested. Here is a tutorial which should help: Working with the Android Calendar

Alternatively, you can create an event and then let the user choose to which Calendar the event should be added: Adding Calendar event through Intent

Community
  • 1
  • 1
dstricks
  • 1,465
  • 12
  • 23