Following is the code which i am using to add events in my android app
Intent intent = new Intent(Intent.ACTION_INSERT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra(Events.TITLE, summary);
intent.putExtra(Events.DESCRIPTION, summary);
intent.putExtra(Events.EVENT_LOCATION, "");
intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginCal.getTimeInMillis());
intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endCal.getTimeInMillis());
intent.putExtra(Events.ALL_DAY, allDayFlag);
intent.putExtra(Events.STATUS, 1);
intent.putExtra(Events.VISIBLE, 0);
intent.putExtra(Events.HAS_ALARM, 1);
startActivity(intent);
This code works good in android 4.0 emulator but when i checked in Samsung Galaxy S II of andriod 4.0 it gets crashed and the error log seems to be as follows
Error ( 4489): android.content.ActivityNotFoundException: No Activity found to handle Intent { act=android.intent.action.INSERT typ=vnd.android.cursor.item/event (has extras) }
how to rectify this error
I tried in the following way and its working fine