0

I use Samasung GalaxyTab 2.2 and i want to call calendar in my Application using Intents

I used

Intent intent = new Intent(Intent.ACTION_VIEW); 
intent.setClassName("com.android.calendar", "com.android.calendar.LaunchActivity"); 
startActivity(intent); 

and

Intent i = new Intent(Intent.ACTION_VIEW);
i.setType("text/calendar");
startActivity(i); 

but it doesn't work for me :(

user1187282
  • 1,137
  • 4
  • 14
  • 23

1 Answers1

0

As a general advice, I would recommend you to post the stacktrace of your errors to obtain better help.
About your issue, I think you are not doing it the right way, take a look at this post.

You have to add a component on your intent :

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);
Community
  • 1
  • 1
Sephy
  • 50,022
  • 30
  • 123
  • 131
  • the error that i got when i use your method : 02-03 11:20:21.433: E/AndroidRuntime(16693): 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? – user1187282 Feb 03 '12 at 11:26