Calendar for Android

ComponentName componentName = new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity"); if (componentName != null) { Intent intent = new Intent(android.content.Intent.ACTION_VIEW); // com.android.providers.calendar.CalendarProvider intent.setFlags(android.content.Intent.FLAG_ACTIVITY_NEW_TASK); intent.setComponent(componentName); startActivity(intent); } else { Log.i("", "98979"); } 

LogCat returns the following error:

ERROR / AndroidRuntime (601): caused by: android.content.ActivityNotFoundException:
Could not find explicit activity class {com.android.calendar/com.android.calendar.LaunchActivity} ;
Have you announced this activity in your AndroidManifest.xml?

What is the new calendar address or package?

+4
source share
3 answers

try it,

works for me to open google calendar and not

  Intent i = new Intent(); //Froyo or greater (mind you I just tested this on CM7 and the less than froyo one worked so it depends on the phone...) cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity"); //less than Froyo cn = new ComponentName("com.android.calendar", "com.android.calendar.LaunchActivity"); i.setComponent(cn); startActivity(i); 

I'm also looking to reveal a phone calendar

+3
source

try this for an open mobile calendar ...

 int sdk = android.os.Build.VERSION.SDK_INT; int ICE_CREAM_BUILD_ID = android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH; if(sdk < ICE_CREAM_BUILD_ID) { // all SDK below ice cream sandwich Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", startTime); intent.putExtra("endTime", endTime); intent.putExtra("title", title); intent.putExtra("description", description); intent.putExtra("eventLocation", location); intent.putExtra("allDay", isAllDay); startActivity(intent); } else { // ice cream sandwich and above Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, startTime); intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime); intent.putExtra(Events.TITLE, title); intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY , isAllDay); intent.putExtra(Events.DESCRIPTION, description); intent.putExtra(Events.EVENT_LOCATION, location); startActivity(intent); } 
+3
source

This only works for common Android phones. On phones where the manufacturer has run its own calendar, the class name of the calendar classes will be different.

+1
source

All Articles