try this for an open mobile calendar ...
int sdk = android.os.Build.VERSION.SDK_INT; int ICE_CREAM_BUILD_ID = android.os.Build.VERSION_CODES.ICE_CREAM_SANDWICH; if(sdk < ICE_CREAM_BUILD_ID) { // all SDK below ice cream sandwich Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra("beginTime", startTime); intent.putExtra("endTime", endTime); intent.putExtra("title", title); intent.putExtra("description", description); intent.putExtra("eventLocation", location); intent.putExtra("allDay", isAllDay); startActivity(intent); } else { // ice cream sandwich and above Intent intent = new Intent(Intent.ACTION_EDIT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, startTime); intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime); intent.putExtra(Events.TITLE, title); intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY , isAllDay); intent.putExtra(Events.DESCRIPTION, description); intent.putExtra(Events.EVENT_LOCATION, location); startActivity(intent); }
Hiral source share