Java Code Examples for android.content.Intent#ACTION_INSERT
The following examples show how to use
android.content.Intent#ACTION_INSERT .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ApiElevenPlus.java From Linphone4Android with GNU General Public License v3.0 | 6 votes |
public static Intent prepareAddContactIntent(String displayName, String sipUri) { Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); intent.putExtra(Insert.NAME, displayName); if (sipUri != null && sipUri.startsWith("sip:")) { sipUri = sipUri.substring(4); } ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ContentValues sipAddressRow = new ContentValues(); sipAddressRow.put(Contacts.Data.MIMETYPE, SipAddress.CONTENT_ITEM_TYPE); sipAddressRow.put(SipAddress.SIP_ADDRESS, sipUri); data.add(sipAddressRow); intent.putParcelableArrayListExtra(Insert.DATA, data); return intent; }
Example 2
Source File: CalendarFragment.java From persian-calendar-view with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH) public void addEventOnCalendar(PersianDate persianDate) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setData(CalendarContract.Events.CONTENT_URI); CivilDate civil = DateConverter.persianToCivil(persianDate); intent.putExtra(CalendarContract.Events.DESCRIPTION, mPersianCalendarHandler.dayTitleSummary(persianDate)); Calendar time = Calendar.getInstance(); time.set(civil.getYear(), civil.getMonth() - 1, civil.getDayOfMonth()); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, time.getTimeInMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, time.getTimeInMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); startActivity(intent); }
Example 3
Source File: ScheduleFragment.java From KUAS-AP-Material with MIT License | 5 votes |
public void AddCalendarEvent(String Msg) { String _time = Msg.split("\\) ")[0].substring(1); String _msg = Msg.split("\\) ")[1]; String _startTime; String _endTime; if (_time.contains("~")) { _startTime = _time.split("~")[0].trim(); _endTime = _time.split("~")[1].trim(); } else { _startTime = _time; _endTime = _time; } Intent calendarIntent = new Intent(Intent.ACTION_INSERT, CalendarContract.Events.CONTENT_URI); Calendar beginTime = Calendar.getInstance(); Calendar endTime = Calendar.getInstance(); beginTime.set(Calendar.getInstance().get(Calendar.YEAR), Integer.parseInt(_startTime.split("/")[0]) - 1, Integer.parseInt(_startTime.split("/")[1]), 0, 0, 0); endTime.set(Calendar.getInstance().get(Calendar.YEAR), Integer.parseInt(_endTime.split("/")[0]) - 1, Integer.parseInt(_endTime.split("/")[1]), 23, 59, 59); calendarIntent .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis()); calendarIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis()); calendarIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); calendarIntent.putExtra(CalendarContract.Events.TITLE, _msg); calendarIntent.putExtra(CalendarContract.Events.EVENT_LOCATION, "國立高雄應用科技大學"); startActivity(calendarIntent); }
Example 4
Source File: NewContactsHelper.java From callerid-for-android with GNU General Public License v3.0 | 5 votes |
public Intent createContactEditor(CallerIDResult result) { final Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType(ContactsContract.Contacts.CONTENT_TYPE); intent.putExtra(ContactsContract.Intents.Insert.NAME, result.getName()); intent.putExtra(ContactsContract.Intents.Insert.PHONE, result.getPhoneNumber()); if(result.getAddress()!=null) intent.putExtra(ContactsContract.Intents.Insert.POSTAL, result.getAddress()); return intent; }
Example 5
Source File: MyCalendarActivity.java From codeexamples-android with Eclipse Public License 1.0 | 5 votes |
public void onClick(View view) { // Intent calIntent = new Intent(Intent.ACTION_INSERT); // calIntent.setData(CalendarContract.Events.CONTENT_URI); // startActivity(calIntent); Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); intent.putExtra(Events.TITLE, "Learn Android"); intent.putExtra(Events.EVENT_LOCATION, "Home suit home"); intent.putExtra(Events.DESCRIPTION, "Download Examples"); // Setting dates GregorianCalendar calDate = new GregorianCalendar(2012, 10, 02); intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, calDate.getTimeInMillis()); intent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, calDate.getTimeInMillis()); // Make it a full day event intent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); // Make it a recurring Event intent.putExtra(Events.RRULE, "FREQ=WEEKLY;COUNT=11;WKST=SU;BYDAY=TU,TH"); // Making it private and shown as busy intent.putExtra(Events.ACCESS_LEVEL, Events.ACCESS_PRIVATE); intent.putExtra(Events.AVAILABILITY, Events.AVAILABILITY_BUSY); startActivity(intent); }
Example 6
Source File: QuickAddDialogFragment.java From opentasks with Apache License 2.0 | 5 votes |
/** * Launch the task editor activity. */ private void editTask() { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setData(Tasks.getContentUri(mAuthority)); Bundle extraBundle = new Bundle(); extraBundle.putParcelable(EditTaskActivity.EXTRA_DATA_CONTENT_SET, buildContentSet()); intent.putExtra(EditTaskActivity.EXTRA_DATA_BUNDLE, extraBundle); getActivity().startActivity(intent); }
Example 7
Source File: TaskListActivity.java From opentasks with Apache License 2.0 | 5 votes |
@Override public void onAddNewTask() { Intent editTaskIntent = new Intent(Intent.ACTION_INSERT); editTaskIntent.setData(Tasks.getContentUri(mAuthority)); startActivityForResult(editTaskIntent, REQUEST_CODE_NEW_TASK); }
Example 8
Source File: CalendarHelper.java From flow-android with MIT License | 5 votes |
public static Intent getAddCalenderEventIntent(Exam exam) { String courseId = exam.getCourseId(); String sections = exam.getSections(); String location = exam.getLocation(); String startDate = ""; String endDate = ""; String startTime = ""; String endTime = ""; Intent intent = new Intent(Intent.ACTION_INSERT); if (exam.getStartDate() != 0 && exam.getEndDate() != 0) { // Missing start/end date. Let's leave this to the user to enter startDate = getDateString(new Date(exam.getStartDate())); endDate = getDateString(new Date(exam.getEndDate())); startTime = getTimeString(new Date(exam.getStartDate())); endTime = getTimeString(new Date(exam.getEndDate())); // TODO: verify that the format of exam.getStartDate() is appropriate intent.putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, exam.getStartDate()) .putExtra(CalendarContract.EXTRA_EVENT_END_TIME, exam.getEndDate()); } intent.setData(CalendarContract.Events.CONTENT_URI) .putExtra(CalendarContract.Events.TITLE, String.format("%s Exam", courseId.toUpperCase())) .putExtra(CalendarContract.Events.DESCRIPTION, String.format("Course: %s\nSection: %s\nDate: %s\nTime: %s - %s\nLocation: %s", courseId, sections, startDate, startTime, endTime, location)) .putExtra(CalendarContract.Events.EVENT_LOCATION, location) .putExtra(CalendarContract.Events.AVAILABILITY, CalendarContract.Events.AVAILABILITY_BUSY); return intent; }
Example 9
Source File: TabContextMenuItemDelegate.java From 365browser with Apache License 2.0 | 5 votes |
@Override public void onAddToContacts(String url) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); intent.setType(ContactsContract.Contacts.CONTENT_TYPE); if (MailTo.isMailTo(url)) { intent.putExtra( ContactsContract.Intents.Insert.EMAIL, MailTo.parse(url).getTo().split(",")[0]); } else if (UrlUtilities.isTelScheme(url)) { intent.putExtra(ContactsContract.Intents.Insert.PHONE, UrlUtilities.getTelNumber(url)); } IntentUtils.safeStartActivity(mTab.getActivity(), intent); }
Example 10
Source File: ContactsServicePlugin.java From flutter_contacts with MIT License | 5 votes |
void openContactForm() { try { Intent intent = new Intent(Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI); intent.putExtra("finishActivityOnSaveCompleted", true); startIntent(intent, REQUEST_OPEN_CONTACT_FORM); }catch(Exception e) { } }
Example 11
Source File: ScheduleFragment.java From KUAS-AP-Material with MIT License | 5 votes |
public void AddCalendarEvent(String Msg) { String _time = Msg.split("\\) ")[0].substring(1); String _msg = Msg.split("\\) ")[1]; String _startTime; String _endTime; if (_time.contains("~")) { _startTime = _time.split("~")[0].trim(); _endTime = _time.split("~")[1].trim(); } else { _startTime = _time; _endTime = _time; } Intent calendarIntent = new Intent(Intent.ACTION_INSERT, CalendarContract.Events.CONTENT_URI); Calendar beginTime = Calendar.getInstance(); Calendar endTime = Calendar.getInstance(); beginTime.set(Calendar.getInstance().get(Calendar.YEAR), Integer.parseInt(_startTime.split("/")[0]) - 1, Integer.parseInt(_startTime.split("/")[1]), 0, 0, 0); endTime.set(Calendar.getInstance().get(Calendar.YEAR), Integer.parseInt(_endTime.split("/")[0]) - 1, Integer.parseInt(_endTime.split("/")[1]), 23, 59, 59); calendarIntent .putExtra(CalendarContract.EXTRA_EVENT_BEGIN_TIME, beginTime.getTimeInMillis()); calendarIntent.putExtra(CalendarContract.EXTRA_EVENT_END_TIME, endTime.getTimeInMillis()); calendarIntent.putExtra(CalendarContract.EXTRA_EVENT_ALL_DAY, true); calendarIntent.putExtra(CalendarContract.Events.TITLE, _msg); calendarIntent.putExtra(CalendarContract.Events.EVENT_LOCATION, "國立高雄應用科技大學"); try { startActivity(calendarIntent); } catch (ActivityNotFoundException e) { Toast.makeText(getContext(), R.string.calender_app_not_found, Toast.LENGTH_SHORT) .show(); } }
Example 12
Source File: CalendarResultHandler.java From reacteu-app with MIT License | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }
Example 13
Source File: TabContextMenuItemDelegate.java From 365browser with Apache License 2.0 | 4 votes |
@Override public boolean supportsAddToContacts() { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType(ContactsContract.Contacts.CONTENT_TYPE); return mTab.getWindowAndroid().canResolveActivity(intent); }
Example 14
Source File: CalendarResultHandler.java From barcodescanner-lib-aar with MIT License | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }
Example 15
Source File: CalendarResultHandler.java From Study_Android_Demo with Apache License 2.0 | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }
Example 16
Source File: CalendarResultHandler.java From weex with Apache License 2.0 | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }
Example 17
Source File: TaskListWidgetProvider.java From opentasks with Apache License 2.0 | 4 votes |
@Override public void onReceive(Context context, Intent intent) { super.onReceive(context, intent); AppWidgetManager appWidgetManager = AppWidgetManager.getInstance(context); int[] appWidgetIds = appWidgetManager.getAppWidgetIds(getComponentName(context)); String action = intent.getAction(); if (action.equals(Intent.ACTION_PROVIDER_CHANGED)) { appWidgetManager.notifyAppWidgetViewDataChanged(appWidgetIds, R.id.task_list_widget_lv); } else if (action.equals(ACTION_CREATE_TASK)) { int widgetId = intent.getIntExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, 0); WidgetConfigurationDatabaseHelper configHelper = new WidgetConfigurationDatabaseHelper(context); SQLiteDatabase db = configHelper.getReadableDatabase(); ArrayList<Long> widgetLists = WidgetConfigurationDatabaseHelper.loadTaskLists(db, widgetId); db.close(); ArrayList<Long> writableLists = new ArrayList<>(); String authority = AuthorityUtil.taskAuthority(context); if (!widgetLists.isEmpty()) { Cursor cursor = context.getContentResolver().query( TaskLists.getContentUri(authority), new String[] { TaskLists._ID }, TaskLists.SYNC_ENABLED + "=1 AND " + TaskLists._ID + " IN (" + TextUtils.join(",", widgetLists) + ")", null, null); if (cursor != null) { while (cursor.moveToNext()) { writableLists.add(cursor.getLong(0)); } cursor.close(); } } Intent editTaskIntent = new Intent(Intent.ACTION_INSERT); editTaskIntent.setData(Tasks.getContentUri(authority)); editTaskIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); if (!writableLists.isEmpty()) { Long preselectList; if (writableLists.size() == 1) { // if there is only one list, then select this one preselectList = writableLists.get(0); } else { // if there are multiple lists, then select the most recently used preselectList = RecentlyUsedLists.getRecentFromList(context, writableLists); } Log.d(getClass().getSimpleName(), "create task with preselected list " + preselectList); ContentSet contentSet = new ContentSet(Tasks.getContentUri(authority)); contentSet.put(Tasks.LIST_ID, preselectList); Bundle extraBundle = new Bundle(); extraBundle.putParcelable(EditTaskActivity.EXTRA_DATA_CONTENT_SET, contentSet); editTaskIntent.putExtra(EditTaskActivity.EXTRA_DATA_BUNDLE, extraBundle); } context.startActivity(editTaskIntent); } }
Example 18
Source File: CalendarResultHandler.java From analyzer-of-android-for-Apache-Weex with Apache License 2.0 | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }
Example 19
Source File: CalendarResultHandler.java From ZXing-Standalone-library with Apache License 2.0 | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }
Example 20
Source File: CalendarResultHandler.java From zxingfragmentlib with Apache License 2.0 | 4 votes |
/** * Sends an intent to create a new calendar event by prepopulating the Add Event UI. Older * versions of the system have a bug where the event title will not be filled out. * * @param summary A description of the event * @param start The start time * @param allDay if true, event is considered to be all day starting from start time * @param end The end time (optional) * @param location a text description of the event location * @param description a text description of the event itself * @param attendees attendees to invite */ private void addCalendarEvent(String summary, Date start, boolean allDay, Date end, String location, String description, String[] attendees) { Intent intent = new Intent(Intent.ACTION_INSERT); intent.setType("vnd.android.cursor.item/event"); long startMilliseconds = start.getTime(); intent.putExtra("beginTime", startMilliseconds); if (allDay) { intent.putExtra("allDay", true); } long endMilliseconds; if (end == null) { if (allDay) { // + 1 day endMilliseconds = startMilliseconds + 24 * 60 * 60 * 1000; } else { endMilliseconds = startMilliseconds; } } else { endMilliseconds = end.getTime(); } intent.putExtra("endTime", endMilliseconds); intent.putExtra("title", summary); intent.putExtra("eventLocation", location); intent.putExtra("description", description); if (attendees != null) { intent.putExtra(Intent.EXTRA_EMAIL, attendees); // Documentation says this is either a String[] or comma-separated String, which is right? } try { // Do this manually at first rawLaunchIntent(intent); } catch (ActivityNotFoundException anfe) { Log.w(TAG, "No calendar app available that responds to " + Intent.ACTION_INSERT); // For calendar apps that don't like "INSERT": intent.setAction(Intent.ACTION_EDIT); launchIntent(intent); // Fail here for real if nothing can handle it } }