简体   繁体   中英

Add Event/Reminder in android calendar that user cannot modify

I want to add the event in the calendar programmatically, and I have successfully done it. But when I call and calendar intent, It will open the calendar with event details on it. Users can modify that event before saving it.

So I want the event to be like noneditable. It will be good if it's getting added automatically. I have looked for so many solutions but nothing worked for me.

Thanks.

 long calID = 3;

 ContentResolver cr = getContentResolver();
 ContentValues values = new ContentValues();
 values.put(CalendarContract.Events.DTSTART, beginTime.getTimeInMillis());                        
 values.put(CalendarContract.Events.ALL_DAY,false);
 values.put(CalendarContract.Events.TITLE, projectName);                         
 values.put(CalendarContract.Events.EVENT_LOCATION,projectAddress);
 values.put(CalendarContract.Events.DESCRIPTION, eventDetail);                           
 values.put(CalendarContract.Events.CALENDAR_ID, calID);                           
 values.put(CalendarContract.Events.EVENT_TIMEZONE,"America/Los_Angeles");
 values.put(CalendarContract.Events.DURATION,"+P1H");
 cr.insert(CalendarContract.Events.CONTENT_URI, values);
 Utility.getInstance().showSnackBar(rl_main, "Event addded to calendar 
  successfully!");

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM