Adding Contact in Android 2.2 API
<p>I am using the new Android 2.2 API to add a contact. I am using the following code to perform the insert.</p>

<pre><code>ArrayList&lt;ContentProviderOperation&gt; ops = new ArrayList&lt;ContentProviderOperation&gt;();
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) {}
</code></pre>

<p>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 ?</p>
