title: Get specific contact information from URI returned from Intent.ACTION_PICK
body: <p>I am writing an Android app that has a data type that represents a person (specifically, the parent or guardian of a child). I'd like to be able to "import" the relevant data fields from the Contacts database in the Android device. (This should be optional; that is, it will not be a requirement that the parent/guardian is already in the Contacts database, nor will the Contacts database be updated if they add new parents/guardians.)</p>
  
  <p>So far, I have written code to start a new Intent to choose the specific Contact (using Intent.ACTION_PICK). I then get a URI that represents a specific Contact in the database.</p>
  
  <p>Unfortunately, I don't know what the next step is. It seems like this should be the simplest thing in the world to do, but apparently not. I've read through the documentation on the Android developer website, and I've looked through more than one Android book. No joy.</p>
  
  <p>The specific information I'd like to get, is:</p>
  
  <ol>
  <li><p>The contact's name (first and last separately if possible)</p></li>
  <li><p>The contact's (primary) email address</p></li>
  <li><p>The contact's cell phone number</p></li>
  </ol>
  
  <p>I imagine that this should be possible by querying using the ContentResolver, but I have no idea how to do this with the URI returned from the Intent. Most of the documentation assumes you have the Contact ID, not the Contact's URI. Also, I have no idea what kind of fields I can put into the projection for the query, assuming that this is even the right way to do what I want.</p>
  
  <p>Here is my starting code:</p>
  
  <pre><code>// In a button's onClick event handler:
  Intent intent = new Intent(Intent.ACTION_PICK, ContactsContract.Contacts.CONTENT_URI);
  startActivityForResult(intent, PICK_CONTACT);
  
  // In onActivityResult:
  if (resultCode == RESULT_OK) {
      if (requestCode == PICK_CONTACT) {
          contactURI = data.getData();
          // NOW WHAT?
      }
  }
  </code></pre>