wblyuyang

  搜索了很长时间,想找个把电话保存到现有联系人的代码,就是打开选中的联系人编辑界面,然后自动添加电话,再手动保存,就跟手机上的一样,功夫不负有心人,终于给搜到了,很不容易啊,现分享如下,

 

 1 // 保存至现有联系人
 2     public void saveExist(String name, String phone) {
 3         Intent intent = new Intent(Intent.ACTION_INSERT_OR_EDIT);
 4         intent.setType("vnd.android.cursor.item/person");
 5         intent.setType("vnd.android.cursor.item/contact");
 6         intent.setType("vnd.android.cursor.item/raw_contact");
 7     //    intent.putExtra(android.provider.ContactsContract.Intents.Insert.NAME, name);
 8         intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE, phone);
 9         intent.putExtra(android.provider.ContactsContract.Intents.Insert.PHONE_TYPE, 3);
10         startActivity(intent);
11     }

  由于现有联系人已经有名称,故把修改联系人名称的代码注释掉。

分类:

技术点:

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-24
  • 2021-04-02
  • 2021-10-02
  • 2021-04-08
猜你喜欢
  • 2021-12-05
  • 2021-04-16
  • 2021-04-09
  • 2022-02-13
  • 2022-01-19
  • 2021-06-19
  • 2022-12-23
相关资源
相似解决方案