Java Code Examples for android.content.Intent#ACTION_INSERT_OR_EDIT
The following examples show how to use
android.content.Intent#ACTION_INSERT_OR_EDIT .
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: ContactsUtils5.java From CSipSimple with GNU General Public License v3.0 | 6 votes |
@Override public Intent getAddContactIntent(String displayName, String csipUri) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Contacts.CONTENT_URI); intent.setType(Contacts.CONTENT_ITEM_TYPE); if (!TextUtils.isEmpty(displayName)) { intent.putExtra(Insert.NAME, displayName); } if (!TextUtils.isEmpty(csipUri)) { ArrayList<ContentValues> data = new ArrayList<ContentValues>(); ContentValues csipProto = new ContentValues(); csipProto.put(Data.MIMETYPE, CommonDataKinds.Im.CONTENT_ITEM_TYPE); csipProto.put(CommonDataKinds.Im.PROTOCOL, CommonDataKinds.Im.PROTOCOL_CUSTOM); csipProto.put(CommonDataKinds.Im.CUSTOM_PROTOCOL, SipManager.PROTOCOL_CSIP); csipProto.put(CommonDataKinds.Im.DATA, SipUri.getCanonicalSipContact(csipUri, false)); data.add(csipProto); intent.putParcelableArrayListExtra(Insert.DATA, data); } return intent; }
Example 2
Source File: ContactDetailsActivity.java From Pix-Art-Messenger with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toEscapedString()); intent.putExtra(Intents.Insert.IM_PROTOCOL, CommonDataKinds.Im.PROTOCOL_JABBER); intent.putExtra("finishActivityOnSaveCompleted", true); try { ContactDetailsActivity.this.startActivityForResult(intent, 0); } catch (ActivityNotFoundException e) { ToastCompat.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show(); } }
Example 3
Source File: GroupMembersDialog.java From Silence with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(DialogInterface dialogInterface, int item) { Recipient recipient = groupMembers.get(item); if (recipient.getContactUri() != null) { ContactsContract.QuickContact.showQuickContact(context, new Rect(0,0,0,0), recipient.getContactUri(), ContactsContract.QuickContact.MODE_LARGE, null); } else { final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(ContactsContract.Intents.Insert.PHONE, recipient.getNumber()); intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); context.startActivity(intent); } }
Example 4
Source File: ConversationActivity.java From Silence with GNU General Public License v3.0 | 5 votes |
private void handleAddToContacts() { try { final Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.putExtra(ContactsContract.Intents.Insert.PHONE, recipients.getPrimaryRecipient().getNumber()); intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); startActivityForResult(intent, ADD_CONTACT); } catch (ActivityNotFoundException e) { Log.w(TAG, e); } }
Example 5
Source File: ContactDetailsActivity.java From Conversations with GNU General Public License v3.0 | 5 votes |
@Override public void onClick(DialogInterface dialog, int which) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); intent.putExtra(Intents.Insert.IM_HANDLE, contact.getJid().toEscapedString()); intent.putExtra(Intents.Insert.IM_PROTOCOL, CommonDataKinds.Im.PROTOCOL_JABBER); intent.putExtra("finishActivityOnSaveCompleted", true); try { ContactDetailsActivity.this.startActivityForResult(intent, 0); } catch (ActivityNotFoundException e) { Toast.makeText(ContactDetailsActivity.this, R.string.no_application_found_to_view_contact, Toast.LENGTH_SHORT).show(); } }
Example 6
Source File: ContactUtil.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@WorkerThread public static @NonNull Intent buildAddToContactsIntent(@NonNull Context context, @NonNull Contact contact) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); if (!TextUtils.isEmpty(contact.getName().getDisplayName())) { intent.putExtra(ContactsContract.Intents.Insert.NAME, contact.getName().getDisplayName()); } if (!TextUtils.isEmpty(contact.getOrganization())) { intent.putExtra(ContactsContract.Intents.Insert.COMPANY, contact.getOrganization()); } if (contact.getPhoneNumbers().size() > 0) { intent.putExtra(ContactsContract.Intents.Insert.PHONE, contact.getPhoneNumbers().get(0).getNumber()); intent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, getSystemType(contact.getPhoneNumbers().get(0).getType())); } if (contact.getPhoneNumbers().size() > 1) { intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE, contact.getPhoneNumbers().get(1).getNumber()); intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_PHONE_TYPE, getSystemType(contact.getPhoneNumbers().get(1).getType())); } if (contact.getPhoneNumbers().size() > 2) { intent.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE, contact.getPhoneNumbers().get(2).getNumber()); intent.putExtra(ContactsContract.Intents.Insert.TERTIARY_PHONE_TYPE, getSystemType(contact.getPhoneNumbers().get(2).getType())); } if (contact.getEmails().size() > 0) { intent.putExtra(ContactsContract.Intents.Insert.EMAIL, contact.getEmails().get(0).getEmail()); intent.putExtra(ContactsContract.Intents.Insert.EMAIL_TYPE, getSystemType(contact.getEmails().get(0).getType())); } if (contact.getEmails().size() > 1) { intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_EMAIL, contact.getEmails().get(1).getEmail()); intent.putExtra(ContactsContract.Intents.Insert.SECONDARY_EMAIL_TYPE, getSystemType(contact.getEmails().get(1).getType())); } if (contact.getEmails().size() > 2) { intent.putExtra(ContactsContract.Intents.Insert.TERTIARY_EMAIL, contact.getEmails().get(2).getEmail()); intent.putExtra(ContactsContract.Intents.Insert.TERTIARY_EMAIL_TYPE, getSystemType(contact.getEmails().get(2).getType())); } if (contact.getPostalAddresses().size() > 0) { intent.putExtra(ContactsContract.Intents.Insert.POSTAL, contact.getPostalAddresses().get(0).toString()); intent.putExtra(ContactsContract.Intents.Insert.POSTAL_TYPE, getSystemType(contact.getPostalAddresses().get(0).getType())); } if (contact.getAvatarAttachment() != null && contact.getAvatarAttachment().getDataUri() != null) { try { ContentValues values = new ContentValues(); values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE); values.put(ContactsContract.CommonDataKinds.Photo.PHOTO, Util.readFully(PartAuthority.getAttachmentStream(context, contact.getAvatarAttachment().getDataUri()))); ArrayList<ContentValues> valuesArray = new ArrayList<>(1); valuesArray.add(values); intent.putParcelableArrayListExtra(ContactsContract.Intents.Insert.DATA, valuesArray); } catch (IOException e) { Log.w(TAG, "Failed to read avatar into a byte array.", e); } } return intent; }
Example 7
Source File: CodePresenter.java From open-location-code with Apache License 2.0 | 4 votes |
private void saveCodeAsContact(String code) { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT); intent.setType(Contacts.CONTENT_ITEM_TYPE); intent.putExtra(Insert.POSTAL, code); mView.getContext().startActivity(intent); }
Example 8
Source File: PatientsList.java From sana.mobile with BSD 3-Clause "New" or "Revised" License | 4 votes |
private void registerNewPatient() { Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT, Subjects.CONTENT_URI); //Toast.makeText(this, "Not available.", Toast.LENGTH_LONG); startActivityForResult(intent, CREATE_PATIENT); }