I can successfully insert a new record using People.CONTENT_URL according to http://developer.android.com/guide/topics/providers/content-providers.html#addingrecord. But the People class is deprecated, So i would like to using ContentProviderOperation and Data.CONTENT_URL to insert record. here is my code.
super.onCreate(savedInstanceState); ArrayList operations = new ArrayList(); operations.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI) .withValue(Phone.CONTACT_ID, "23").withValue(CommonDataKinds.Phone.NUMBER, "13412341234123412341234").build()); try { getContentResolver().applyBatch(ContactsContract.AUTHORITY, operations); } catch (RemoteException e) { // TODO Auto-generated catch block e.printStackTrace(); } catch (OperationApplicationException e) { // TODO Auto-generated catch block e.printStackTrace(); }