Using foreign keys and ContactsContract
<p>I'm building an app where I need the user to select some "favorite" contacts and a phone number. I'm able to select a contact using </p>

<pre><code>    startActivityForResult(new Intent(Intent.ACTION_PICK, Contacts.CONTENT_URI), PICK_CONTACT_REQUEST);
</code></pre>

<p>and I'm able to extract all the information I need. </p>

<p>I then proceed to save the _id of the contact into my own database. My plan is to later list all the "favorited" contacts and display the name and phonenumber in a listview. </p>

<p>I want to save the contact id instead of the name and number so my listview will reflect any changes the user makes to his or her contacts.</p>

<p>But now I'm stuck. I don't know how to transform my table with contacts ids into a table with contact names. </p>

<p>I would like to something like this</p>

<pre><code>my_table LEFT OUTER JOIN contacts_table ON (my_table.contact_id = contacts_table._id)
</code></pre>
