Tutorials Android How to Add an Event to Android Calendar

How to Add an Event to Android Calendar

The following code snippet shows how to add event in Android calendar using intent method.

Intent intent = new Intent(Intent.ACTION_INSERT);
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, eventDate.getTimeInMillis())
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, eventDate.getTimeInMillis() + 60 * 60 * 1000)
intent.putExtra(CalendarContract.Events.TITLE, title)
intent.putExtra(CalendarContract.Events.DESCRIPTION, description)
intent.putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY);

Toast.makeText(context, "Event added to calendar, Toast.LENGTH_SHORT).show(); 
Leave a Reply

Your email address will not be published.

Previous Post

How to Determine Android Screen Size Width and Height

Next Post
Install WordPress Theme

Beginners Guide: How to Install a WordPress Theme

Related Posts
By clicking “Allow All”, you agree to the storing of cookies on your device to enhance site navigation, analyze site usage, and assist in our marketing efforts. Cookie Notice
Allow All