title: Getting a Photo from a Contact
body: <p>Alright, I'm just trying to learn about using Contact information, but I'm a bit stuck.  I would like to be able to display a picture for the contact.  Using the following code that I have, how would I be able to put the photo for the contact in the ImageView in contact_entry?</p>
  
  <pre><code>ListView contacts_list = (ListView) findViewById(R.id.contacts_list);
  
  // Gets the URI of the db
  Uri uri = ContactsContract.Contacts.CONTENT_URI;
  // What to grab from the db
  String[] projection = new String[] {
          ContactsContract.Contacts._ID,
          ContactsContract.Contacts.DISPLAY_NAME,
          ContactsContract.Contacts.PHOTO_ID
  };
  
  String sortOrder = ContactsContract.Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
  
  Cursor cursor = managedQuery(uri, projection, null, null, sortOrder);
  
  String[] fields = new String[] {
          ContactsContract.Data.DISPLAY_NAME
  };
  
  int[] values = { 
          R.id.contactEntryText
  };
  
  SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.contact_entry, cursor,
          fields, values);
  contacts_list.setAdapter(adapter);
  </code></pre>
  
  <p><strong>contact_entry.xml</strong></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout 
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="54px"&gt;
      &lt;ImageView
          android:id="@+id/contactPhoto"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content" 
          android:src="@drawable/ic_contact_picture_3"/&gt;
      &lt;TextView 
          android:text="@+id/contactEntryText"
          android:id="@+id/contactEntryText"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"/&gt;
  &lt;/LinearLayout&gt;
  </code></pre>