Using intents to view calendar data
Calender Provider offers two different ways to use the VIEW Intent:
To open the Calendar to a particular date.
To view an event.
add permissions to manifest
<uses-permission android:name="android.permission.READ_CALENDAR" />
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
Here is an example that shows how to open the Calendar to a particular date:
// A date-time specified in milliseconds since the epoch.
long startMillis;
...
Uri.Builder builder = CalendarContract.CONTENT_URI.buildUpon();
builder.appendPath("time");
ContentUris.appendId(builder, startMillis);
Intent intent = new Intent(Intent.ACTION_VIEW)
.setData(builder.build());
startActivity(intent);
Here is an example that shows how to open an event for viewing:
long eventID = 208;
...
Uri uri = ContentUris.withAppendedId(Events.CONTENT_URI, eventID);
Intent intent = new Intent(Intent.ACTION_VIEW)
.setData(uri);
startActivity(intent);
Is it possible to launch the Calendar to a specific week or day?
So, now it is possible, but requires min API 14
.
For more details visit http://developer.android.com/guide/topics/providers/calendar-provider.html#intents