<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-5343967186246241755</id><updated>2026-05-23T08:23:17.258-07:00</updated><title type='text'>Android contacts: CONTACT_ID vs RAW_CONTACT_ID</title><subtitle type='html'>Explains a brief study on Android CONTACT_ID and RAW_CONTACT_ID.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://android-contact-id-vs-raw-contact-id.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5343967186246241755/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://android-contact-id-vs-raw-contact-id.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ali Chousein</name><uri>http://www.blogger.com/profile/15925871269074773713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZkW3e0y_5wV6XjWVRv1SFMaLy2adh8cu75E99Z3AY2M5Tjd9l4_lkSpSry7fV59BYbyetUqgsWBAz7PB_KaNa3AqKMUtd2okIoF8y0JgaMNK9cXyx_pcKoNnL2ZxX_A/s220/chousein.png'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>1</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-5343967186246241755.post-8847951950297977344</id><published>2011-04-16T14:49:00.000-07:00</published><updated>2011-12-17T12:17:51.614-08:00</updated><title type='text'>Android contacts: CONTACT_ID vs RAW_CONTACT_ID - A brief study</title><content type='html'>Almost everybody who works with Android contacts asks the same question: What is CONTACT_ID, what is RAW_CONTACT_ID and what is the difference between them? To unveil this mistery for myself, I did some debugging on Android and got a good understanding how it works. Because I couldn&#39;t find a comprehensive explanation of this subject anywhere, I decided to share my findings with anybody who would be interested.&lt;br /&gt;
&lt;br /&gt;
In summary, RAW_CONTACT_ID refers to every individual contact you create on Android; this is referred to as &lt;i&gt;raw contact&lt;/i&gt;. Some of the raw contacts are automatically grouped together. CONTACT_ID refers to such a group. There is a one-to-many relationship between CONTACT_ID and RAW_CONTACT_ID.&lt;br /&gt;
&lt;br /&gt;
Let&#39;s consider some examples and start by creating contact entries.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
CREATE A CONTACT&lt;br /&gt;
&lt;br /&gt;
Suppose that we create the following contacts, in the specified order.&lt;br /&gt;
&lt;br /&gt;
1. Katherine Solomon - Home: 01-234-5678&lt;br /&gt;
&lt;br /&gt;
2. Katherine Solomon - Work: katherine.solomon@lostsymbol.com&lt;br /&gt;
&lt;br /&gt;
Android groups these two contacts together and shows them as a single entry in the contacts list. The values of CONTACT_ID and &amp;nbsp;RAW_CONTACT_ID are shown below. We assume that we start from a clean phone; hense the numbers start from 1 (Hint: You can always start from a clean emulator if you wish. Just create a new Android Virtual Device).&lt;br /&gt;
&lt;br /&gt;
Katherine Solomon&lt;br /&gt;
1.Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.NUMBER:01-234-5678&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.TYPE:TYPE_HOME&lt;br /&gt;
&lt;br /&gt;
2.Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.DATA:katherine.solomon@lostsymbol.com&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.TYPE:TYPE_WORK&lt;br /&gt;
&lt;br /&gt;
The two &quot;Katherine Solomons&quot; we just created are automatically grouped together and are assigned the same CONTACT_ID. However, each entry has its unique RAW_CONTACT_ID. When you open Android contacts, you&#39;ll see one entry for Katherine Solomon, showing both the phone number and the e-mail address. This is the CONTACT. However, when you edit this contact, then you&#39;ll see two entries for Katherine Solomon; one showing the phone number and the other showing the e-mail address. These are the RAW_CONTACTS.&lt;br /&gt;
&lt;br /&gt;
Next we add another contact entry:&lt;br /&gt;
&lt;br /&gt;
3. Robert Langdon - Home: 01-876-5432, &amp;nbsp;Work: &amp;nbsp;robert.langdon@lostsymbol.com&lt;br /&gt;
(This time we specify both a phone number and an e-mail address when creating the entry.)&lt;br /&gt;
&lt;br /&gt;
Then the related entries for this contact are as follows:&lt;br /&gt;
&lt;br /&gt;
Robert Langdon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.CONTACT_ID:3&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:3&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Robert Langdon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Robert&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Langdon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.NUMBER:01-876-5432&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.TYPE:TYPE_HOME&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.DATA:robert.langdon@lostsymbol.com&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.TYPE:TYPE_WORK&lt;br /&gt;
&lt;br /&gt;
Because the new contact has a different name, it is not grouped with any of the existing ones and gets its own CONTACT_ID. Android contacts show two entries now, one for Katherine Solomon and one for Robert Langdon.&lt;br /&gt;
&lt;br /&gt;
It&#39;s worth to note that there is a 1-to-1 relationship between the CONTACT_ID and the DISPLAY_NAME.&lt;br /&gt;
&lt;br /&gt;
The next question is, what happens when you change the name of a contact. How does this affect, or does it affect the existing groupings?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
EDIT THE NAME OF AN EXISTING CONTACT&lt;br /&gt;
&lt;br /&gt;
Suppose that Katherine Solomon gets married and changes her family name to Langdon. Suppose also that we update the family name only of the entry RAW_CONTACT_ID:1 but we do not update the family name of the entry RAW_CONTACT_ID:2.&lt;br /&gt;
&lt;br /&gt;
Then Android contacts still show two entries in the contacts list:&lt;br /&gt;
&lt;br /&gt;
Katherine Solomon&lt;br /&gt;
Robert Langdon&lt;br /&gt;
&lt;br /&gt;
Then the related entries for Katherine Solomon are as as displayed below. The arrow (&amp;lt;---) shows the only value which has changed.&lt;br /&gt;
&lt;br /&gt;
Katherine Solomon&lt;br /&gt;
1.Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Langdon &amp;nbsp;&amp;lt;---&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.NUMBER:01-234-5678&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.TYPE:TYPE_HOME&lt;br /&gt;
&lt;br /&gt;
2.Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.DATA:katherine.solomon@lostsymbol.com&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.TYPE:TYPE_WORK&lt;br /&gt;
&lt;br /&gt;
Please note that the display name of both entries remain the same and both entries are still grouped together, even though we changed the FAMILY_NAME of one of them.&lt;br /&gt;
&lt;br /&gt;
If we change the FAMILY_NAME of the entry with RAW_CONTACT_ID:2 also, then the display name of the group as well is changed and the following entry appears in Android contacts:&lt;br /&gt;
&lt;br /&gt;
Katherine &amp;nbsp;Langdon&lt;br /&gt;
1.Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Langdon &amp;nbsp;&amp;lt;---&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Langdon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.NUMBER:01-234-5678&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.TYPE:TYPE_HOME&lt;br /&gt;
&lt;br /&gt;
2.Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Langdon &amp;nbsp;&amp;lt;---&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Langdon &amp;nbsp;&amp;lt;---&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.DATA:katherine.solomon@lostsymbol.com&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.TYPE:TYPE_WORK&lt;br /&gt;
&lt;br /&gt;
In my opinion, this behavior is very handy and it makes the life of a software developer very easy when dealing with Android contacts.&lt;br /&gt;
&lt;br /&gt;
But, what is the behavior when we delete contacts?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
DELETE A CONTACT&lt;br /&gt;
&lt;br /&gt;
Android contacts allow deleting a CONTACT and not individual RAW_CONTACT. If we delete &quot;Katherine &amp;nbsp;Langdon&quot; then both raw contacts RAW_CONTACT_ID:1 and RAW_CONTACT_ID:2 will be deleted.&lt;br /&gt;
&lt;br /&gt;
Programmatically, it&#39;s possible to do more of course.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PROGRAMMATICALLY INSERT A CONTACT INTO A DESIRED GROUP&lt;br /&gt;
&lt;br /&gt;
Suppose that we have the original &quot;Katherine Solomon&quot; contacts we created and we have not deleted any contact entry. Next, we programmatically insert the following contact: &lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// For brevity the ContactsContract and&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// ContactsContract.CommonDataKinds&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;prefixes are ignored.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ArrayList&amp;lt;ContentProviderOperation&amp;gt; ops = new ArrayList&amp;lt;ContentProviderOperation&amp;gt;();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;int rawContactInsertIndex = ops.size();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(RawContacts.ACCOUNT_TYPE, null)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(RawContacts.ACCOUNT_NAME, null)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.build());&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(Data.MIMETYPE, StructuredName.CONTENT_ITEM_TYPE)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(StructuredName.DISPLAY_NAME, &quot;Lost Symbol Characters&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(StructuredName.GIVEN_NAME, &quot;Katherine&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(StructuredName.FAMILY_NAME, &quot;Solomon&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.build()); &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(Data.MIMETYPE, Phone.CONTENT_ITEM_TYPE)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(Phone.NUMBER, &quot;09876543&quot;)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withValue(Phone.TYPE, Phone.TYPE_MOBILE) &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.build());&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// For brevity, the try-catch statement is ignored.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// Normally it&#39;s needed.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;getContentResolver().applyBatch(AUTHORITY, ops);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
In this operation we specifically assigned a DISPLAY_NAME value to the new contract. Even though the GIVEN_NAME and FAMILY_NAME of the new contact is exactly the same with the contacts &amp;nbsp;RAW_CONTACT_ID:1 and RAW_CONTACT_ID:2, the new contact gets a new CONTACT_ID and appears under a new group. The new entry in Android contacts is as follows:&lt;br /&gt;
&lt;br /&gt;
Lost Symbol Characters&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.CONTACT_ID:4&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:4&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Lost Symbol Characters&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.NUMBER:09876543&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Phone.TYPE:TYPE_MOBILE&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
PROGRAMMATICALLY DELETE A RAW_CONTRACT&lt;br /&gt;
&lt;br /&gt;
Programmatically it&#39;s possible to delete raw contacts. Suppose that we programmaticall delete &amp;nbsp;RAW_CONTACT_ID:1 using the code below.&lt;br /&gt;
&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// For brevity the ContactsContract and&amp;nbsp;&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// ContactsContract.CommonDataKinds&amp;nbsp;&lt;/span&gt;&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;prefixes are ignored.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ArrayList&amp;lt;ContentProviderOperation&amp;gt; ops = new ArrayList&amp;lt;ContentProviderOperation&amp;gt;();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;int rawContactInsertIndex = ops.size();&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;ops.add(ContentProviderOperation.newDelete(RawContacts.CONTENT_URI)&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.withSelection(RawContacts._ID + &quot; = ?&quot;, new String[]{&quot;1&quot;})&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.build());&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// For brevity, the try-catch statement is ignored.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;// Normally it&#39;s needed.&lt;/span&gt;&lt;br /&gt;
&lt;span class=&quot;Apple-style-span&quot; style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;getContentResolver().applyBatch(AUTHORITY, ops);&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;
After this deletion the entries for &quot;Katherine Solomon&quot; are as follows:&lt;br /&gt;
&lt;br /&gt;
Katherine Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.CONTACT_ID:1&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Data.RAW_CONTACT_ID:2&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.DISPLAY_NAME:Katherine Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.GIVEN_NAME:Katherine&lt;br /&gt;
&amp;nbsp;&amp;nbsp;StructuredName.FAMILY_NAME:Solomon&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.DATA:katherine.solomon@lostsymbol.com&lt;br /&gt;
&amp;nbsp;&amp;nbsp;Email.TYPE:TYPE_WORK&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
This has been my brief investigation of Android ContactsContract. I also tried to update the DISPLAY_NAME of a raw contract but the behavior I observed seems to be buggy. (The corresponding bug entry is: &lt;a href=&quot;http://code.google.com/p/android/issues/detail?id=16188&amp;amp;colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&quot;&gt;http://code.google.com/p/android/issues/detail?id=16188&amp;amp;colspec=ID%20Type%20Status%20Owner%20Summary%20Stars&lt;/a&gt;) In general my opinion is that, the Android folks did a good job in designing ContactsContract. I find it very convenient to work with it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Other related blogs:&lt;/b&gt;&lt;br /&gt;
&lt;br /&gt;
Email addresses in Android contacts&lt;br /&gt;
&lt;a href=&quot;http://email-addresses-in-android-contacts.blogspot.com/&quot;&gt;http://email-addresses-in-android-contacts.blogspot.com/&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
Geo-Filtered Assistant&lt;br /&gt;
&lt;a href=&quot;http://geo-filtered-assistant.blogspot.com/&quot;&gt;http://geo-filtered-assistant.blogspot.com/&lt;/a&gt;&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;b&gt;Support information sharing:&lt;/b&gt;&lt;br /&gt;
To support free information sharing please visit one of our sponsors below.&lt;br /&gt;
&lt;div&gt;&lt;br /&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://android-contact-id-vs-raw-contact-id.blogspot.com/feeds/8847951950297977344/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://android-contact-id-vs-raw-contact-id.blogspot.com/2011/04/android-contacts-contactid-vs.html#comment-form' title='4 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/5343967186246241755/posts/default/8847951950297977344'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/5343967186246241755/posts/default/8847951950297977344'/><link rel='alternate' type='text/html' href='http://android-contact-id-vs-raw-contact-id.blogspot.com/2011/04/android-contacts-contactid-vs.html' title='Android contacts: CONTACT_ID vs RAW_CONTACT_ID - A brief study'/><author><name>Ali Chousein</name><uri>http://www.blogger.com/profile/15925871269074773713</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='28' height='32' src='//blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhZkW3e0y_5wV6XjWVRv1SFMaLy2adh8cu75E99Z3AY2M5Tjd9l4_lkSpSry7fV59BYbyetUqgsWBAz7PB_KaNa3AqKMUtd2okIoF8y0JgaMNK9cXyx_pcKoNnL2ZxX_A/s220/chousein.png'/></author><thr:total>4</thr:total></entry></feed>