• Android 把电话保存到现有联系人 已有联系人


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

     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     }

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

  • 相关阅读:
    sqlalchemy 使用pymysql连接mysql 1366错误
    mysql之数据导出
    Go常见语句
    huffman code
    后缀数组,目前比较赶进度,而且有点难,所以放到以后再来看
    hash
    bipartite matching
    spanning tree
    拓扑排序
    Union Find
  • 原文地址:https://www.cnblogs.com/wblyuyang/p/4061876.html
Copyright © 2020-2023  润新知