lordhong
lordhong

Reputation: 1227

A generic Intent to launch Calendar app on Android?

For stock Android ROMs, we can launch the Google Calendar app by:

Intent intent = new Intent(Intent.ACTION_EDIT);

intent.setType("vnd.android.cursor.item/event");   

intent.putExtra("title", "Some title");

intent.putExtra("description", "Some description");

startActivity(intent);

However, it looks like manufacturers w/ custom UIs implemented their own Calendar, such as HTC Sense UI.
I'm not sure about MotoBlur and Samsung TouchWiz, but I assume they are doing the same.

So, the question is: is there a generic Intent we can use to launch the Calendar app on Android phones (regardless it's stock android or custom UI)? Or we kind of need to write a wrapper class to check and launch the appropriate calendars?

Upvotes: 1

Views: 1256

Answers (1)

hackbod
hackbod

Reputation: 91321

There is currently no supported API for the calendar. What you are doing is relying on private implementation details (the need to hand-write a string literal for the MIME type indicates this), so you are going to get different behavior on different devices depending their implementation.

Upvotes: 3

Related Questions