views:

513

answers:

2
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:
Unable to find explicit activity class {com.android.calendar/com.android.calendar.LaunchActivity};
have you declared this activity in your AndroidManifest.xml?

What is the new calendar address or package?

A: 

In the original blob of horribly formatted, uncompilable code, there was a line that seemed out of place, which I removed:

();com.android.providers.calendar.CalendarProvider

What was this line supposed to read? Could you provide the original source?

Could you also post the contents of AndroidManifest.xml?

Paul Lammertsma
A: 

This only works for generic android phones. On phones where the manufacturer have implemented their own calendar the class name of the calendar classes will be different.

Leif