Java tutorial
//package com.java2s; //License from project: Apache License import org.joda.time.DateTime; import android.content.ContentUris; import android.content.Intent; import android.provider.CalendarContract; import android.provider.CalendarContract.Events; public class Main { public static Intent createOpenCalendarEventIntent(int eventId, DateTime from, DateTime to) { Intent intent = createCalendarIntent(Intent.ACTION_VIEW); intent.setData(ContentUris.withAppendedId(Events.CONTENT_URI, eventId)); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, from.getMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, to.getMillis()); return intent; } private static Intent createCalendarIntent(String action) { Intent intent = new Intent(); intent.setAction(action); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED | Intent.FLAG_ACTIVITY_CLEAR_TOP); return intent; } }