Add contact, use transaction public void Testaddcontact () {String name[]={"Jay Chou", "Nicholas Tse Feng", "Yan Cheng Xu", "JJ Lin", "Wilber Bai", "Ming Dao", "Donnie Yen", "zhouyumin", "Show Luo", "May Days", "Andy Lau", "Mai June Long", "Cheng Long", "Su has Friends", "Life", "Du", "Kevin Cheng", "Wu Chun", "inflammation of the sub-Lun", "Guoshui", "Tangyvzhe", "Huddivan", "Wang Dongcheng"}; for (String ss:name) {//Insert null value First, then get rawcontactsid for interpolation below contentvalues values = new Contentvalues (); Insert a null value Uri Rawcontacturi = Getcontentresolver (). Insert (Rawcontacts.content_uri,va Lues); Long Rawcontactsid = Contenturis.parseid (Rawcontacturi); Insert name Values.clear () into the empty record just now; A reference to the _id, this data belongs to Values.put (STRUCTUREDNAME.RAW_CONTACT_ID,RAWCONTACTSID); "Content_item_type" MIME TYPE used when storing the in data table Values.put (data.mimetype,s Tructuredname.content_item_type); The name that should is used to display of the contact. ValuEs.put (STRUCTUREDNAME.DISPLAY_NAME,SS); Insert the real values Getcontentresolver (). Insert (data.content_uri,values); Insert phone values.clear (); Values.put (PHONE.RAW_CONTACT_ID,RAWCONTACTSID); String "Data.mimetype": The MIME type of the item represented by this row//string "Content_item_type": MIME Type used when storing the this in data table. Values.put (Data.mimetype,phone.content_item_type); Values.put (Phone.number, "1008611"); Getcontentresolver (). Insert (data.content_uri,values); } }