今天添加了一个联系人可是却在联系人名单中没有,但是查询这个人还是在的
为什么呢 后来发现
ContentValues contentValues = new ContentValues(); contentValues.put(Contacts.People.NAME, name);
Uri contactUri = this.getContentResolver().insert(Contacts.People.CONTENT_URI, contentValues);
Intent intent = new Intent(Intent.ACTION_VIEW, contactUri); this.startActivity(intent);
然后需要
int contactId = Integer.valueOf(contactUri.toString().substring(contactUri.toString().lastIndexOf("/")+1));
Contacts.People.addToMyContactsGroup(this.getContentResolver(), contactId);