title: How can I add a contact picture inside ContentProviderOperation?
body: <p>With the snippet below, I am able to sync all my contact with a REST API.
  That's great and everything works fine. I can add people with name and phone number.</p>
  
  <p>Unfortunately, I am now trying without success to add a picture from SDCard ( I get a Bitmap or a Drawable)</p>
  
  <p>Can someone point me a way to achieve this or give me some clues?</p>
  
  <p>Thank a lot!</p>
  
  <p>here is the sample code I currently use:   </p>
  
  <pre><code>ArrayList&lt;ContentProviderOperation&gt; ops = new ArrayList&lt;ContentProviderOperation&gt;();
  int rawContactInsertIndex = ops.size();
  
  ops.add(ContentProviderOperation.newInsert(RawContacts.CONTENT_URI)
     .withValue(RawContacts.ACCOUNT_TYPE, null)
     .withValue(RawContacts.ACCOUNT_NAME,null )
     .build());
  ops.add(ContentProviderOperation.newInsert(ContactsContract.Data.CONTENT_URI)
     .withValueBackReference(ContactsContract.Data.RAW_CONTACT_ID, rawContactInsertIndex)
     .withValue(Data.MIMETYPE,Phone.CONTENT_ITEM_TYPE)
     .withValue(Phone.NUMBER, "9X-XXXXXXXXX")
     .build());
  ops.add(ContentProviderOperation.newInsert(Data.CONTENT_URI)
     .withValueBackReference(Data.RAW_CONTACT_ID, rawContactInsertIndex)
     .withValue(Data.MIMETYPE,StructuredName.CONTENT_ITEM_TYPE)
     .withValue(StructuredName.DISPLAY_NAME, "Mike Sullivan")
     .build());  
  ContentProviderResult[] res = getContentResolver().applyBatch(ContactsContract.AUTHORITY, ops);
  </code></pre>