首页 > 移动平台 > 详细

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

时间:2014-10-30 10:18:10      阅读:281      评论:0      收藏:0      [点我收藏+]

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

 

 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     }

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

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

原文:http://www.cnblogs.com/wblyuyang/p/4061876.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!