Android 调用系统联系人界面的添加联系人,添加已有联系人,编辑和修改。
2017-03-07 14:45
621 查看
一、添加联系人
二、添加到已有联系人
三、编辑联系人
四、删除联系人
Intent addIntent = new Intent(Intent.ACTION_INSERT,Uri.withAppendedPath(Uri.parse("content://com.android.contacts"), "contacts")); addIntent.setType("vnd.android.cursor.dir/person"); addIntent.setType("vnd.android.cursor.dir/contact"); addIntent.setType("vnd.android.cursor.dir/raw_contact");
addIntent.putExtra(ContactsContract.Intents.Insert.NAME,number);名称: addIntent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, numberForNewConstant);
电话: startActivity(addIntent);
二、添加到已有联系人
LogUtil.logI("================btnAddToOladContact====================="); Intent oldConstantIntent = new Intent(Intent.ACTION_INSERT_OR_EDIT); oldConstantIntent.setType(ContactsContract.Contacts.CONTENT_ITEM_TYPE); oldConstantIntent.putExtra(ContactsContract.Intents.Insert.PHONE, numberForNewConstant); oldConstantIntent.putExtra(ContactsContract.Intents.Insert.PHONE_TYPE, 3); startActivity(oldConstantIntent); if(oldConstantIntent.resolveActivity(getActivity().getPackageManager()) != null){ LogUtil.logI("================btnAddToOladContact=========yes============"); startActivity(oldConstantIntent); }else LogUtil.logI("================btnAddToOladContact=========no============");
三、编辑联系人
Intent editIntent = new Intent(Intent.ACTION_EDIT,Uri.parse("content://com.android.contacts/contacts/"+cb.getContactId())); startActivity(editIntent);
四、删除联系人
//*************删除联系人****************** Uri deleteUri = ContentUris.withAppendedId(ContactsContract.Contacts.CONTENT_URI, cb.getContactId()); Uri lookupUri = ContactsContract.Contacts.getLookupUri(ContactsDetailActivity.this.getContentResolver(), deleteUri); if (lookupUri != Uri.EMPTY) { int del = ContactsDetailActivity.this.getContentResolver().delete(deleteUri, null, null); LogUtil.logI("==========popupMenu============del:"+del); }
相关文章推荐
- Android 调用系统联系人界面的添加联系人,添加已有联系人,编辑和修改。
- Android 调用系统联系人界面(添加联系人,添加已有联系人,编辑和修改)
- android 从项目中调用系统添加联系人界面
- Android调用系统添加和编辑联系人的返回结果
- 调用系统联系人的添加界面-android
- Android调用系统存储联系人界面,以及系统短信发送
- 调用系统自带的联系人管理程序(添加,删除,编辑)
- 向Android系统自带的联系人界面添加数据
- Android调用系统自带的联系人界面
- 转到编辑联系人的系统界面 编辑 添加
- 向Android系统自带的联系人界面添加数据
- 调用系统添加联系人界面的套路
- Android中可通过二维码扫描,直接显示个人名片信息,而且可以点击添加,调用系统的添加联系人功能
- android各种界面跳转(调用系统联系人,通话记录,发短信,发邮件,google搜索)
- android stuido 添加自定义jar 调用修改修改后的安卓系统方法
- Android添加数据到系统自带的联系人界面
- 向Android系统自带的联系人界面添加数据
- android 调用系统通讯录添加联系人,并将号码传值到相应的控件内
- android 如何打开系统联系人界面
- 调用Android系统“应用程序信息(Application Info)”界面