Wednesday, May 22, 2013

How to open calendar intent programmatically

I was looking around for a way to open the calendar application for viewing. The closest solution I found was running the stock calendar app explicitally using the package name.

Here's the best solution I came up with to open for viewing the Android calendar:
Intent i = new Intent(Intent.ACTION_VIEW);
// Android 2.2+
i.setData(Uri.parse("content://com.android.calendar/time"));  
// Before Android 2.2+
//i.setData(Uri.parse("content://calendar/time"));  

startActivity(i);

2 comments:

Bapa Nagar said...

ooh thanx Sagi's
i was looking for the same..

Unknown said...

Thanks lot , It very helped me.