Reputation: 161
Intent calIntent = new Intent(Intent.ACTION_VIEW);
calIntent.setData(CalendarContract.Events.CONTENT_URI);
startActivity(calIntent);
I added permissions in the manifest file, but doesn't work.
Upvotes: 0
Views: 544
Reputation: 8629
You're missing a few steps (like setting the time you want to view, for example), have a look at the documentation, that I'm copying here for reference :
// 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);
Unfortunately, I don't think forcing the calendar app in month view is at all possible. The above will open the calendar for the given time but if the user has set his calendar app in week view mode, there isn't much you can do about it. I'd love to be proved wrong about that last bit ! :-)
Upvotes: 1