I hope to start Android system calendar UI to insert a new Event.
I use following code on 4.0(IceCream) and it works.
Intent calIntent = new Intent(Intent.ACTION_INSERT);
calIntent.setType("vnd.android.cursor.item/event");
calIntent.putExtra("title", summary);
calIntent.putExtra("description", description);
calIntent.putExtra("beginTime", startts);
calIntent.putExtra("endTime", stopts);
startActivity(calIntent);
But it failed on GingerBread(2.3) or Froyo(2.2), I got a NoActivityFound exception: No Activity found to handle intent.
Is there anyway to open Android system calendar below 4.0?
I see some thread about my issue. All the answers insert an Event to Calendar immediately without start system Calendar. I hope start system calendar and let the user to confirm whether or not they want insert the event.
The CalendarContract content provider was added to the Android SDK in API Level 14. This set of APIs allows third party developers to access and manipulate user calendar data, provided the user has configured a calendaring application on the device. Users may have no calendaring support configured, or they may have multiple calendar instances (Work vs. Play).
Supporting Older Android Devices
Unfortunately,
this Calendaring APIs are not backwards compatible with older versions of the platform (prior to Android 4.0, or API Level 14).These features are not part of the latest Support Package, and we are not expecting to see it in a future revision. If your application must attempt to work with calendars on older platform versions, see our other article about unofficial access to the user’s calendar but understand you are not following Android best practices by using it. That being said, the difference is surprisingly minimal. Effectively, the CalendarContract documented the previously undocumented APIs. Some values changed, but creating a compatibility interface to work with the old version and the new version may possible for those that require it. There are older handsets where the undocumented method will not work, however, so the solution is still not perfect.