title: Changing contact's image to a large photo via PHOTO_FILE_ID in Android
body: <p>This seems to work for small images:</p>
  
  <pre><code>ContentValues values = new ContentValues();
  
  values.put(ContactsContract.Data.RAW_CONTACT_ID, id);
  values.put(ContactsContract.Data.IS_SUPER_PRIMARY, 1);
  values.put(ContactsContract.CommonDataKinds.Photo.PHOTO, photo);
  values.put(ContactsContract.Data.MIMETYPE, ContactsContract.CommonDataKinds.Photo.CONTENT_ITEM_TYPE);
  if (photoRow &gt;= 0) {
      context.getContentResolver().update(ContactsContract.Data.CONTENT_URI, values, ContactsContract.Data._ID + " = " + photoRow, null);
  } else {
      context.getContentResolver().insert(ContactsContract.Data.CONTENT_URI, values);
  }
  </code></pre>
  
  <p>From the <a href="http://developer.android.com/reference/android/provider/ContactsContract.DisplayPhoto.html">docs</a> I realise that for large images I need to set the PHOTO_FILE_ID, so I can replace:</p>
  
  <pre><code>ContactsContract.CommonDataKinds.Photo.PHOTO
  </code></pre>
  
  <p>with:</p>
  
  <pre><code>ContactsContract.CommonDataKinds.Photo.PHOTO_FILE_ID
  </code></pre>
  
  <p>However, then I need to supply a PHOTO_FILE_ID rather than raw data. My question:</p>
  
  <ol>
  <li>How do I save the photo (byte []) and get a PHOTO_FILE_ID?</li>
  <li>If there is already a photo available (PHOTO not PHOTO_FILE_ID). Do I need to delete it for the big image to be seen or does the big image take precedence, if not, how do I delete it?</li>
  </ol>