0

I am trying to open calendar from my app and using the code below as i found it in this question :how can i open the calendar from my app? ...but getting following error

07-01 14:19:26.299: ERROR/AndroidRuntime(14167): Caused by: android.content.ActivityNotFoundException: Unable to find explicit activity class {com.google.android.calendar/com.android.calendar.LaunchActivity}; have you declared this activity in your AndroidManifest.xml?

any help will be useful..

Intent i = new Intent();
    ComponentName cn = new ComponentName("com.google.android.calendar", "com.android.calendar.LaunchActivity"); 
    i.setComponent(cn); 
    startActivity(i);
Community
  • 1
  • 1
vindaaron
  • 87
  • 1
  • 6

1 Answers1

0

Have you tried specifying permissions ?

http://developer.android.com/reference/android/Manifest.permission.html#READ_CALENDAR

or alternatively use:

    Intent intent = new Intent(Intent.ACTION_EDIT);  
    intent.setType("vnd.android.cursor.item/event");
    intent.putExtra("title", "Some title");
    intent.putExtra("description", "Some description");
    intent.putExtra("beginTime", new java.util.Date().getTime());
    intent.putExtra("endTime", new java.util.Date().getTime()+36000000);
    startActivity(intent);
rior
  • 168
  • 2
  • 9