android 通讯录中不同版本的区别

一、添加联系人

1.6上的代码:

String peopleName = "name";

ContentValues personValues = new ContentValues();// 

namepersonValues.put(Contacts.People.NAME, peopleName);/* STARRED 0 = Contacts, 1 = Favorites */

personValues.put(Contacts.People.STARRED, 0);

Uri newPersonUri = Contacts.People.createPersonInMyContactsGroup(getContentResolver(), personValues);


2.1上的代码:

String peopleName = "name";

ContentValues personValues = new ContentValues();

// namepersonValues.put(Contacts.People.NAME, peopleName);

newPersonUri = getContentResolver().insert(People.CONTENT_URI, personValues);

你可能感兴趣的:(android 通讯录中不同版本的区别)