tags:

views:

57

answers:

1

I am using the new Android 2.2 API to add a contact. I am using the following code to perform the insert.

ArrayList<ContentProviderOperation> ops = new ArrayList<ContentProviderOperation>();
ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
    .withValue(Data.RAW_CONTACT_ID, id)
    .withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)
    .withValue(Data.DISPLAY_NAME, first_name)
    .withValue(Phone.NUMBER, pnumber)
    .withValue(Phone.TYPE, Phone.TYPE_CUSTOM)
    .build());
try {
    getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
} catch (RemoteException e) {}
catch (OperationApplicationException e) {}

The code executes fine without any exception. However, the new contact is not visible in the Android Contacts. I tried searching on the net but couldn't find any answer. What I might be doing wrong ?

A: 

can you see the fields for the user to fill in like the number and email? cause i can't

mikedroid