title: Android: Set contact photo in a ListView with name and number
body: <p>I'm creating an app that needs to display the phone contacts with its photo, name and number. I've created a ListView and can show contacts and numbers with a generic photo, but I can't show contat's picture. This is my code:
  <code></p>
  
  <pre><code>Cursor cursor = getContacts();
  
  String[] fields = new String[] {Contacts.DISPLAY_NAME, Phone.NUMBER};
  
  SimpleCursorAdapter adapter = new SimpleCursorAdapter(this, R.layout.contact_entry, cursor,
              fields, new int[] {R.id.contactEntryText, R.id.contactEntryNumber});
  
  mContactList.setAdapter(adapter);
  
  private Cursor getContacts()
  
      // Run query
      Uri uri = Phone.CONTENT_URI;
      String[] projection = new String[] {
              Contacts._ID,
              Contacts.DISPLAY_NAME,
              Phone.NUMBER,
              Contacts.PHOTO_ID
  
      };
      //String selection = Contacts.HAS_PHONE_NUMBER + "='1'";
      String selection = null;
      String[] selectionArgs = null;
      String sortOrder = Contacts.DISPLAY_NAME + " COLLATE LOCALIZED ASC";
  
      return managedQuery(uri, projection, selection, selectionArgs, sortOrder);
  }
  </code></pre>
  
  <p></code></p>
  
  <p>How can I attach the contact's picture in the SimpleCursorAdapter? Is there another?</p>
  
  <p>Thank you very much.</p>