国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 系統(tǒng) > Android > 正文

Android 調(diào)用系統(tǒng)聯(lián)系人界面(添加聯(lián)系人,添加已有聯(lián)系人,編輯和修改)

2019-12-12 03:27:15
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

一、添加聯(lián)系人

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);

二、添加到已有聯(lián)系人

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============");

三、編輯聯(lián)系人

Intent editIntent = new Intent(Intent.ACTION_EDIT,Uri.parse("content://com.android.contacts/contacts/"+cb.getContactId()));            startActivity(editIntent);

四、刪除聯(lián)系人

//*************刪除聯(lián)系人******************                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 調(diào)用系統(tǒng)聯(lián)系人界面(添加聯(lián)系人,添加已有聯(lián)系人,編輯和修改),希望對(duì)大家有所幫助,如果大家有任何疑問(wèn)請(qǐng)給我留言,小編會(huì)及時(shí)回復(fù)大家的。在此也非常感謝大家對(duì)武林網(wǎng)網(wǎng)站的支持!

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 宝兴县| 沙雅县| 旬阳县| 昌江| 施秉县| 天全县| 保康县| 肥乡县| 油尖旺区| 安塞县| 庆元县| 姚安县| 高要市| 彭水| 东阿县| 武城县| 安西县| 体育| 德昌县| 张家川| 金塔县| 桐城市| 靖江市| 拜泉县| 凤凰县| 庐江县| 英山县| 秀山| 额敏县| 武强县| 营口市| 江川县| 将乐县| 崇信县| 老河口市| 新沂市| 兰考县| 新民市| 安福县| 台江县| 华宁县|