Android跳转到系统通讯录新增和修改联系人
来源:互联网 发布:网络炮仗什么意思 编辑:程序博客网 时间:2024/05/16 13:42
新增联系人:
Intent intent = new Intent(Intent.ACTION_INSERT, ContactsContract.Contacts.CONTENT_URI);intent.putExtra(android.provider.ContactsContract.Intents.Insert.NAME, name);intent.putExtra(android.provider.ContactsContract.Intents.Insert.JOB_TITLE, title);intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, phone);startActivity(intent);
修改联系人:
Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);intent.setType("vnd.android.cursor.item/person");intent.setType("vnd.android.cursor.item/contact");intent.setType("vnd.android.cursor.item/raw_contact");intent.putExtra(android.provider.ContactsContract.Intents.Insert.NAME, name);intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, phone);intent.putExtra(android.provider.ContactsContract.Intents.Insert.JOB_TITLE, title);startActivity(intent);
各个字段的api
public static final class Insert { /** The action code to use when adding a contact */ public static final String ACTION = Intent.ACTION_INSERT; /** * If present, forces a bypass of quick insert mode. */ public static final String FULL_MODE = "full_mode"; /** * The extra field for the contact name. * <P>Type: String</P> */ public static final String NAME = "name"; // TODO add structured name values here. /** * The extra field for the contact phonetic name. * <P>Type: String</P> */ public static final String PHONETIC_NAME = "phonetic_name"; /** * The extra field for the contact company. * <P>Type: String</P> */ public static final String COMPANY = "company"; /** * The extra field for the contact job title. * <P>Type: String</P> */ public static final String JOB_TITLE = "job_title"; /** * The extra field for the contact notes. * <P>Type: String</P> */ public static final String NOTES = "notes"; /** * The extra field for the contact phone number. * <P>Type: String</P> */ public static final String PHONE = "phone"; /** * The extra field for the contact phone number type. * <P>Type: Either an integer value from * {@link CommonDataKinds.Phone}, * or a string specifying a custom label.</P> */ public static final String PHONE_TYPE = "phone_type"; /** * The extra field for the phone isprimary flag. * <P>Type: boolean</P> */ public static final String PHONE_ISPRIMARY = "phone_isprimary"; /** * The extra field for an optional second contact phone number. * <P>Type: String</P> */ public static final String SECONDARY_PHONE = "secondary_phone"; /** * The extra field for an optional second contact phone number type. * <P>Type: Either an integer value from * {@link CommonDataKinds.Phone}, * or a string specifying a custom label.</P> */ public static final String SECONDARY_PHONE_TYPE = "secondary_phone_type"; /** * The extra field for an optional third contact phone number. * <P>Type: String</P> */ public static final String TERTIARY_PHONE = "tertiary_phone"; /** * The extra field for an optional third contact phone number type. * <P>Type: Either an integer value from * {@link CommonDataKinds.Phone}, * or a string specifying a custom label.</P> */ public static final String TERTIARY_PHONE_TYPE = "tertiary_phone_type"; /** * The extra field for the contact email address. * <P>Type: String</P> */ public static final String EMAIL = "email"; /** * The extra field for the contact email type. * <P>Type: Either an integer value from * {@link CommonDataKinds.Email} * or a string specifying a custom label.</P> */ public static final String EMAIL_TYPE = "email_type"; /** * The extra field for the email isprimary flag. * <P>Type: boolean</P> */ public static final String EMAIL_ISPRIMARY = "email_isprimary"; /** * The extra field for an optional second contact email address. * <P>Type: String</P> */ public static final String SECONDARY_EMAIL = "secondary_email"; /** * The extra field for an optional second contact email type. * <P>Type: Either an integer value from * {@link CommonDataKinds.Email} * or a string specifying a custom label.</P> */ public static final String SECONDARY_EMAIL_TYPE = "secondary_email_type"; /** * The extra field for an optional third contact email address. * <P>Type: String</P> */ public static final String TERTIARY_EMAIL = "tertiary_email"; /** * The extra field for an optional third contact email type. * <P>Type: Either an integer value from * {@link CommonDataKinds.Email} * or a string specifying a custom label.</P> */ public static final String TERTIARY_EMAIL_TYPE = "tertiary_email_type"; /** * The extra field for the contact postal address. * <P>Type: String</P> */ public static final String POSTAL = "postal"; /** * The extra field for the contact postal address type. * <P>Type: Either an integer value from * {@link CommonDataKinds.StructuredPostal} * or a string specifying a custom label.</P> */ public static final String POSTAL_TYPE = "postal_type"; /** * The extra field for the postal isprimary flag. * <P>Type: boolean</P> */ public static final String POSTAL_ISPRIMARY = "postal_isprimary"; /** * The extra field for an IM handle. * <P>Type: String</P> */ public static final String IM_HANDLE = "im_handle"; /** * The extra field for the IM protocol */ public static final String IM_PROTOCOL = "im_protocol"; /** * The extra field for the IM isprimary flag. * <P>Type: boolean</P> */ public static final String IM_ISPRIMARY = "im_isprimary"; /** * The extra field that allows the client to supply multiple rows of * arbitrary data for a single contact created using the {@link Intent#ACTION_INSERT} * or edited using {@link Intent#ACTION_EDIT}. It is an ArrayList of * {@link ContentValues}, one per data row. Supplying this extra is * similar to inserting multiple rows into the {@link Data} table, * except the user gets a chance to see and edit them before saving. * Each ContentValues object must have a value for {@link Data#MIMETYPE}. * If supplied values are not visible in the editor UI, they will be * dropped. Duplicate data will dropped. Some fields * like {@link CommonDataKinds.Email#TYPE Email.TYPE} may be automatically * adjusted to comply with the constraints of the specific account type. * For example, an Exchange contact can only have one phone numbers of type Home, * so the contact editor may choose a different type for this phone number to * avoid dropping the valueable part of the row, which is the phone number. * <p> * Example: * <pre> * ArrayList<ContentValues> data = new ArrayList<ContentValues>(); * * ContentValues row1 = new ContentValues(); * row1.put(Data.MIMETYPE, Organization.CONTENT_ITEM_TYPE); * row1.put(Organization.COMPANY, "Android"); * data.add(row1); * * ContentValues row2 = new ContentValues(); * row2.put(Data.MIMETYPE, Email.CONTENT_ITEM_TYPE); * row2.put(Email.TYPE, Email.TYPE_CUSTOM); * row2.put(Email.LABEL, "Green Bot"); * row2.put(Email.ADDRESS, "android@android.com"); * data.add(row2); * * Intent intent = new Intent(Intent.ACTION_INSERT, Contacts.CONTENT_URI); * intent.putParcelableArrayListExtra(Insert.DATA, data); * * startActivity(intent); * </pre> */ public static final String DATA = "data"; /** * Used to specify the account in which to create the new contact. * <p> * If this value is not provided, the user is presented with a disambiguation * dialog to chose an account * <p> * Type: {@link Account} */ public static final String EXTRA_ACCOUNT = "android.provider.extra.ACCOUNT"; /** * Used to specify the data set within the account in which to create the * new contact. * <p> * This value is optional - if it is not specified, the contact will be * created in the base account, with no data set. * <p> * Type: String */ public static final String EXTRA_DATA_SET = "android.provider.extra.DATA_SET";}
阅读全文
0 0
- Android跳转到系统通讯录新增和修改联系人
- Android跳转到通讯录选择联系人
- android 跳转到系统通讯录
- Android 跳转到系统联系人获取姓名和手机号
- 保存联系人到系统通讯录
- android 跳转到通讯录并获取展示到页面 及android联系人信息获取
- android调用系统通讯录,并返回联系人号码和称呼
- Android调用系统通讯录,并返回联系人号码和称呼
- iOS保存联系人到系统通讯录
- 通讯录联系人跳转
- Android批量添加联系人到通讯录
- Android实现批量添加联系人到通讯录
- ContentProvider获取系统的电话号码绑定到ListView以及跳转通讯录获区联系人信息绑定到前台。
- android 访问系统通讯录得到联系人数据
- Android中获取系统通讯录联系人
- Android点击跳转到联系人列表、拨号面板和通话记录
- Android跳转到通讯录获取用户名称和手机号码
- Android跳转到通讯录获取用户名称和手机号码
- JEESZ分布式框架简介--技术介绍文档
- Spring AOP 实现原理
- 野指针和内存操作分析
- Linux下opencv通过V4L获取摄像头图像的底层源码icvRetrieveFrameCAM_V4L
- select、poll和epoll
- Android跳转到系统通讯录新增和修改联系人
- Spring MVC中响应请求的大致流程
- 使用ajax提交form表单,包括ajax文件上传
- Sublime Text 文档编码
- Android 自定义View双指放大
- Android图片加载框架最全解析(二),从源码的角度理解Glide的执行流程
- 欢迎使用CSDN-markdown编辑器
- 《Unix环境高级编程》 总结 (二)
- poj1973