title: display contact image in image view
body: <p>I want to get a contacts image and display it in an imageview.  I want this to work based on what contact the user chooses.  I have a button that has the user press it and get contact phone number and display it in a text field. but now i need it to get a photo and display it. does anybody have  an idea of how i can manipulate this to get photos?
  (ignore the logs that say email and my variables that say email, i manipulated the code so it gets phone numbers instead.)</p>
  
  <pre><code>case CONTACT_PICKER_RESULT:
                  Cursor cursor = null;
                  String email = "";
                  try {
                      Bundle extras = data.getExtras();
                      Set&lt;String&gt; keys = extras.keySet();
                      Iterator&lt;String&gt; iterate = keys.iterator();
                      while (iterate.hasNext()) {
                          String key = iterate.next();
                          Log.v(DEBUG_TAG, key + "[" + extras.get(key) + "]");
                      }
  
                      Uri result = data.getData();
                      Log.v(DEBUG_TAG,
                              "Got a contact result: " + result.toString());
  
                      // get the contact id from the Uri
                      String id = result.getLastPathSegment();
  
                      // query for everything email
                      cursor = getContentResolver().query(Phone.CONTENT_URI,
                              null, Phone.CONTACT_ID + "=?", new String[] { id },
                              null);
  
                      int emailIdx = cursor.getColumnIndex(Phone.DATA);
  
                      // let's just get the first email
                      if (cursor.moveToFirst()) {
  
                          /*
                           * Iterate all columns. :) String columns[] =
                           * cursor.getColumnNames(); for (String column :
                           * columns) { int index = cursor.getColumnIndex(column);
                           * Log.v(DEBUG_TAG, "Column: " + column + " == [" +
                           * cursor.getString(index) + "]"); }
                           */
  
                          email = cursor.getString(emailIdx);
  
                          Log.v(DEBUG_TAG, "Got email: " + email);
  
                      } else {
                          Log.w(DEBUG_TAG, "No results");
                      }
                  } catch (Exception e) {
                      Log.e(DEBUG_TAG, "Failed to get email data", e);
                  } finally {
                      if (cursor != null) {
                          cursor.close();
                      }
                      EditText emailEntry = (EditText) findViewById(R.id.txtPhoneNo);
                      emailEntry.setText(email);
                      if (email.length() == 0) {
                          Toast.makeText(this, "No email found for contact.",
                                  Toast.LENGTH_LONG).show();
                      }
  
                  }
  
                  break;
              }
  
          } else {
              Log.w(DEBUG_TAG, "Warning: activity result not ok");
          }
      }
  </code></pre>