广告
返回顶部
首页 > 资讯 > 移动开发 >Android 调用系统联系人界面(添加联系人,添加已有联系人,编辑和修改)
  • 600
分享到

Android 调用系统联系人界面(添加联系人,添加已有联系人,编辑和修改)

调用联系界面系统Android 2022-06-06 01:06:22 600人浏览 独家记忆
摘要

一、添加联系人 Intent addIntent = new Intent(Intent.ACTioN_INSERT,Uri.withAppendedPath(Uri.par

一、添加联系人


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获取手机通讯录、sim卡联系人及调用拨号界面方法


--结束END--

本文标题: Android 调用系统联系人界面(添加联系人,添加已有联系人,编辑和修改)

本文链接: https://www.lsjlt.com/news/22038.html(转载时请注明来源链接)

有问题或投稿请发送至: 邮箱/279061341@qq.com    QQ/279061341

本篇文章演示代码以及资料文档资料下载

下载Word文档到电脑,方便收藏和打印~

下载Word文档
猜你喜欢
软考高级职称资格查询
编程网,编程工程师的家园,是目前国内优秀的开源技术社区之一,形成了由开源软件库、代码分享、资讯、协作翻译、讨论区和博客等几大频道内容,为IT开发者提供了一个发现、使用、并交流开源技术的平台。
  • 官方手机版

  • 微信公众号

  • 商务合作